Skip to content

Commit

Permalink
(F) node: Properly set Time.now workaround
Browse files Browse the repository at this point in the history
It actually depends on the Python version. In Python 2 you can
directly set attributes of a method function, while this is forbidden
in Python 3. But it can be also related to term like "unbound method",
which was not a thing before.
  • Loading branch information
jara001 committed Oct 17, 2023
1 parent db91a88 commit ef51e29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Unreleased
### Fixed
- `uninode`
- `Time.now()` is now properly set in Python 3.

## 0.9.4 - 2023-10-11
### Added
- `uninode`:
Expand Down
7 changes: 6 additions & 1 deletion autopsy/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ def __init__(self, name):
super(Node, self).__init__(name)

# Workaround for Time.now()
self.Time.now = super(Node, self).get_clock().now
try:
# Python 2
self.Time.now = super(Node, self).get_clock().now
except:
# Python 3
self.Time.__func__.now = super(Node, self).get_clock().now


def Publisher(self, name, data_class, subscriber_listener=None, tcp_nodelay=False, latch=False, headers=None, queue_size=None):
Expand Down

0 comments on commit ef51e29

Please sign in to comment.