Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Bug report
After adding "traceback" and "typing" modules to freeze_modules.py,"sorted" will raise TypeError when compiling.
def generate_frozenset(self, name: str, fs: FrozenSet[object]) -> str: ret = self.generate_tuple(name, tuple(sorted(fs))) self.write("// TODO: The above tuple should be a frozenset") return retFrozen "traceback" raise:
TypeError: '<' not supported between instances of 'int' and 'NoneType'Frozen "typing" raise:
TypeError: '<' not supported between instances of 'str' and 'NoneType'After that I printed fs:
try: ret = self.generate_tuple(name, tuple(sorted(fs)))except TypeError: print(f"name: {name}, fs: {fs}") raise"traceback" and "typing" are output as follows
name: traceback_toplevel_consts_46_consts_14_consts_9, fs: frozenset({None, 0})name: typing_toplevel_consts_112_consts_1, fs: frozenset({None, 'functools', 'abc'})I don't understand what the sorted does in the Frozen module here.
Finally, I used a temporary method to unsort these two FrozenSet in the exception handling, and successfully passed the compilation.
def generate_frozenset(self, name: str, fs: FrozenSet[object]) -> str: try: ret = self.generate_tuple(name, tuple(sorted(fs))) except TypeError: if name == 'traceback_toplevel_consts_46_consts_14_consts_9' or \ name == 'typing_toplevel_consts_112_consts_1': ret = self.generate_tuple(name, tuple(fs)) else: raise self.write("// TODO: The above tuple should be a frozenset") return retEnvironment
I checkout v3.11.0b4 after cloning, use Ubuntu 22.04 LTS, arch is x86_64.