-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #56, undo RepyV1 uniqueid patch #194
base: master
Are you sure you want to change the base?
Fix #56, undo RepyV1 uniqueid patch #194
Conversation
The `uniqueid` module had a bug when "imported" with the RepyV1 preprocessor, `repypp`. (That program had no notion of modules already imported, so it would paste multiple copies of imported libraries and thus cause duplicate IDs with the `uniqueid` module). This bug was patched for V1, but the patch never removed since. In RepyV2, `dylink` is used to import modules, and it does a much better job at importing modules only once, see for instance SeattleTestbed#55. Therefore, we can remove the old patch! To verify that removing the patch is safe, I also added a unit test that checks `uniqueid`'s * basic functionality, * functioning after reimport, and * function across threads.
|
||
current_time = getruntime() | ||
uniqueid_idlist = [int((current_time - int(current_time)) * 2**32)] | ||
uniqueid_idlist = [0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exactly does this have to be a list? It will always only hold one element, right?
|
||
uniqueid2 = dy_import_module("uniqueid.r2py") | ||
|
||
assert uniqueid2.uniqueid_getid() != uniqueid.uniqueid_getid(), "Got the same ID twice after pseudo-reimporting!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also verify that uniqueid2
does not return an id that was already returned by uniqueid
, i.e.
assert uniqueid2.uniqueid_getid() not in oldids
to catch the case that the new import resets the module store.
sleep(5) | ||
|
||
for anid in idlist: | ||
assert idlist.count(anid)==1, "Duplicate ID: " + str(anid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idlist.count(anid) == 1
(whitespaces)
The
uniqueid
module had a bug when "imported" with the RepyV1preprocessor,
repypp
. (That program had no notion of modules alreadyimported, so it would paste multiple copies of imported libraries
and thus cause duplicate IDs with the
uniqueid
module). This bugwas patched for V1, but the patch never removed since.
In RepyV2,
dylink
is used to import modules, and it does a muchbetter job at importing modules only once, see for instance
#55. Therefore, we can remove the old
patch!
To verify that removing the patch is safe, I also added a unit test
that checks
uniqueid
's