[issue39846] Register .whl as a unpack format in shutil unpack
John Andersen added the comment: I ran into this today. Using a wrapper function around _make_zipfile due to https://github.com/python/cpython/blob/d5650a1738fe34f6e1db4af5f4c4edb7cae90a36/Lib/shutil.py#L817-L819 where there is a check for if the format is zip then don't pass owner and group. ``` def make_whlfile(*args, owner=None, group=None, **kwargs): return shutil._make_zipfile(*args, **kwargs) shutil.register_archive_format("whl", make_whlfile, description="Wheel file") shutil.register_unpack_format( "whl", [".whl"], shutil._unpack_zipfile, description="Wheel file" ) ``` -- nosy: +pdxjohnny ___ Python tracker <https://bugs.python.org/issue39846> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37247] swap distutils build_ext and build_py commands to allow proper SWIG extension installation
John Andersen added the comment: I haven't made much progress on the fix yet. But I have a workaround here: https://github.com/tpm2-software/tpm2-pytss/commit/9952e374b4d9b854aea12c667dd7d7ab4ad501a9 -- ___ Python tracker <https://bugs.python.org/issue37247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40427] importlib of module results in different id than when imported with import keyword
John Andersen added the comment: Thank you! :) I must have missed that somehow -- ___ Python tracker <https://bugs.python.org/issue40427> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40427] importlib of module results in different id than when imported with import keyword
New submission from John Andersen : When importing a file using importlib the id() of the object being imported is not the same as when imported using the `import` keyword. I feel like this is a bug. As if I have a package which is using relative imports, and then I import all of the files in that package via importlib. issubclass and isinstance and others no longer work when the relative imported object and then importlib imported object are checked against each other, I assume because the id()s are different. $ cat > target.py <<'EOF' class Target: pass EOF $ cat > importer.py <<'EOF' import importlib from target import Target spec = importlib.util.spec_from_file_location("target", "target.py") imported_by_importlib = importlib.util.module_from_spec(spec) spec.loader.exec_module(imported_by_importlib) print("isinstance(imported_by_importlib.Target(), Target:", isinstance(imported_by_importlib.Target(), Target)) print("id(Target):", id(Target)) print("id(imported_by_importlib.Target):", id(imported_by_importlib.Target)) EOF $ python importer.py isinstance(imported_by_importlib.Target(), Target: False id(Target): 93824998820112 id(imported_by_importlib.Target): 93824998821056 -- messages: 367554 nosy: pdxjohnny priority: normal severity: normal status: open title: importlib of module results in different id than when imported with import keyword type: behavior versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue40427> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37247] swap distutils build_ext and build_py commands to allow proper SWIG extension installation
John Andersen added the comment: I'm going to take a stab at this by adding build_swig which will run if the list of files only contains .i files. -- ___ Python tracker <https://bugs.python.org/issue37247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37247] swap distutils build_ext and build_py commands to allow proper SWIG extension installation
Change by John Andersen : -- nosy: +pdxjohnny ___ Python tracker <https://bugs.python.org/issue37247> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35000] aexit called after loop close
Change by John Andersen : Added file: https://bugs.python.org/file47872/test.py ___ Python tracker <https://bugs.python.org/issue35000> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35000] aexit called after loop close
New submission from John Andersen : aexit called after loop close on death by signal. This seems odd, the __aexit__ method must be running in a loop because it is an async function. However if one calls shield then it dies. ''' $ python3.7 test.py Hello! # Ctrl-C before 5 seconds is up $ python3.7 test.py ^CException ignored in: Traceback (most recent call last): File "test.py", line 18, in func await asyncio.sleep(5) File "test.py", line 14, in __aexit__ await asyncio.shield(self.other()) File "/usr/lib/python3.7/asyncio/tasks.py", line 765, in shield inner = ensure_future(arg, loop=loop) File "/usr/lib/python3.7/asyncio/tasks.py", line 577, in ensure_future task = loop.create_task(coro_or_future) File "/usr/lib/python3.7/asyncio/base_events.py", line 384, in create_task self._check_closed() File "/usr/lib/python3.7/asyncio/base_events.py", line 461, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed sys:1: RuntimeWarning: coroutine 'Test.other' was never awaited ''' import os import signal import asyncio class Test(object): async def other(self): print('Hello!') async def __aenter__(self): pass async def __aexit__(self, a, b, c): await asyncio.shield(self.other()) async def func(): async with Test(): await asyncio.sleep(5) def main(): loop = asyncio.get_event_loop() try: loop.run_until_complete(func()) except KeyboardInterrupt: pass loop.run_until_complete(loop.shutdown_asyncgens()) loop.close() if __name__ == '__main__': main() -- components: asyncio messages: 327839 nosy: asvetlov, pdxjohnny, yselivanov priority: normal severity: normal status: open title: aexit called after loop close versions: Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue35000> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32972] unittest.TestCase coroutine support
John Andersen added the comment: I've updated my pull request to do the following: 1. Provide a new AsyncTestCase class which is a subclass of TestCase 2. Run coroutines with a coroutineRunner property. a. In 3.6 this calls get_evet_loop.run_until_complete b. In 3.7 > this calls asyncio.run 3. setUp, testMethod s, and tearDown can be either async or not Thoughts? -- ___ Python tracker <https://bugs.python.org/issue32972> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32972] unittest.TestCase coroutine support
John Andersen added the comment: More discussion indeed. I figured I was not alone in my desire to see async test support in the stdlib. Let me know what other changes would be good. -- ___ Python tracker <https://bugs.python.org/issue32972> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32972] unittest.TestCase coroutine support
New submission from John Andersen : This makes unittest TestCase classes run `test_` methods which are async -- components: Tests, asyncio messages: 313063 nosy: asvetlov, pdxjohnny, yselivanov priority: normal pull_requests: 5708 severity: normal status: open title: unittest.TestCase coroutine support type: behavior versions: Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue32972> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com