Skip to content

Instantly share code, notes, and snippets.

@horpto
Created February 7, 2022 19:13
Show Gist options
  • Save horpto/32a5c25f4c8e28147f5df1e2530fa190 to your computer and use it in GitHub Desktop.
Save horpto/32a5c25f4c8e28147f5df1e2530fa190 to your computer and use it in GitHub Desktop.
diff of bad and ok versions.py
user@horpto:~/develop/notes/gevent$ diff wrong.py ok.py
479,540d478
< # possible namespace for /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco
< import 'pkg_resources._vendor.jaraco' # <_frozen_importlib_external._NamespaceLoader object >
< import 'pkg_resources.extern.jaraco' # <pkg_resources.extern.VendorImporter object >
< # /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/text/__pycache__/__init__.cpython-310.pyc matches /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/text/__init__.py
< # code object from '/usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/text/__pycache__/__init__.cpython-310.pyc'
< # /usr/local/lib/python3.10/importlib/__pycache__/resources.cpython-310.pyc matches /usr/local/lib/python3.10/importlib/resources.py
< # code object from '/usr/local/lib/python3.10/importlib/__pycache__/resources.cpython-310.pyc'
< # /usr/local/lib/python3.10/importlib/__pycache__/_common.cpython-310.pyc matches /usr/local/lib/python3.10/importlib/_common.py
< # code object from '/usr/local/lib/python3.10/importlib/__pycache__/_common.cpython-310.pyc'
< # /usr/local/lib/python3.10/__pycache__/typing.cpython-310.pyc matches /usr/local/lib/python3.10/typing.py
< # code object from '/usr/local/lib/python3.10/__pycache__/typing.cpython-310.pyc'
< import 'typing' # <_frozen_importlib_external.SourceFileLoader object >
< # /usr/local/lib/python3.10/importlib/__pycache__/abc.cpython-310.pyc matches /usr/local/lib/python3.10/importlib/abc.py
< # code object from '/usr/local/lib/python3.10/importlib/__pycache__/abc.cpython-310.pyc'
< import 'importlib.abc' # <_frozen_importlib_external.SourceFileLoader object >
< # /usr/local/lib/python3.10/importlib/__pycache__/_adapters.cpython-310.pyc matches /usr/local/lib/python3.10/importlib/_adapters.py
< # code object from '/usr/local/lib/python3.10/importlib/__pycache__/_adapters.cpython-310.pyc'
< import 'importlib._adapters' # <_frozen_importlib_external.SourceFileLoader object >
< import 'importlib._common' # <_frozen_importlib_external.SourceFileLoader object >
< import 'importlib.resources' # <_frozen_importlib_external.SourceFileLoader object >
< # /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/__pycache__/functools.cpython-310.pyc matches /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/functools.py
< # code object from '/usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/__pycache__/functools.cpython-310.pyc'
< # /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/__init__.cpython-310.pyc matches /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/__init__.py
< # code object from '/usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/__init__.cpython-310.pyc'
< # /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/more.cpython-310.pyc matches /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/more.py
< # code object from '/usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/more.cpython-310.pyc'
< # /usr/local/lib/python3.10/concurrent/__pycache__/__init__.cpython-310.pyc matches /usr/local/lib/python3.10/concurrent/__init__.py
< # code object from '/usr/local/lib/python3.10/concurrent/__pycache__/__init__.cpython-310.pyc'
< import 'concurrent' # <_frozen_importlib_external.SourceFileLoader object >
< # /usr/local/lib/python3.10/concurrent/futures/__pycache__/__init__.cpython-310.pyc matches /usr/local/lib/python3.10/concurrent/futures/__init__.py
< # code object from '/usr/local/lib/python3.10/concurrent/futures/__pycache__/__init__.cpython-310.pyc'
< # /usr/local/lib/python3.10/concurrent/futures/__pycache__/_base.cpython-310.pyc matches /usr/local/lib/python3.10/concurrent/futures/_base.py
< # code object from '/usr/local/lib/python3.10/concurrent/futures/__pycache__/_base.cpython-310.pyc'
< # /usr/local/lib/python3.10/logging/__pycache__/__init__.cpython-310.pyc matches /usr/local/lib/python3.10/logging/__init__.py
< # code object from '/usr/local/lib/python3.10/logging/__pycache__/__init__.cpython-310.pyc'
< import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
< import 'logging' # <_frozen_importlib_external.SourceFileLoader object >
< import 'concurrent.futures._base' # <_frozen_importlib_external.SourceFileLoader object >
< import 'concurrent.futures' # <_frozen_importlib_external.SourceFileLoader object >
< # /usr/local/lib/python3.10/concurrent/futures/__pycache__/thread.cpython-310.pyc matches /usr/local/lib/python3.10/concurrent/futures/thread.py
< # code object from '/usr/local/lib/python3.10/concurrent/futures/__pycache__/thread.cpython-310.pyc'
< # /usr/local/lib/python3.10/__pycache__/queue.cpython-310.pyc matches /usr/local/lib/python3.10/queue.py
< # code object from '/usr/local/lib/python3.10/__pycache__/queue.cpython-310.pyc'
< # extension module '_queue' loaded from '/usr/local/lib/python3.10/lib-dynload/_queue.cpython-310-x86_64-linux-gnu.so'
< # extension module '_queue' executed from '/usr/local/lib/python3.10/lib-dynload/_queue.cpython-310-x86_64-linux-gnu.so'
< import '_queue' # <_frozen_importlib_external.ExtensionFileLoader object >
< import 'queue' # <_frozen_importlib_external.SourceFileLoader object >
< import 'concurrent.futures.thread' # <_frozen_importlib_external.SourceFileLoader object >
< # /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/recipes.cpython-310.pyc matches /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/recipes.py
< # code object from '/usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/more_itertools/__pycache__/recipes.cpython-310.pyc'
< import 'pkg_resources._vendor.more_itertools.recipes' # <_frozen_importlib_external.SourceFileLoader object >
< import 'pkg_resources._vendor.more_itertools.more' # <_frozen_importlib_external.SourceFileLoader object >
< import 'pkg_resources._vendor.more_itertools' # <_frozen_importlib_external.SourceFileLoader object >
< import 'pkg_resources.extern.more_itertools' # <pkg_resources.extern.VendorImporter object >
< import 'pkg_resources.extern.jaraco.functools' # <_frozen_importlib_external.SourceFileLoader object >
< # /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/__pycache__/context.cpython-310.pyc matches /usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/context.py
< # code object from '/usr/local/lib/python3.10/site-packages/pkg_resources/_vendor/jaraco/__pycache__/context.cpython-310.pyc'
< import 'pkg_resources.extern.jaraco.context' # <_frozen_importlib_external.SourceFileLoader object >
< # /usr/local/lib/python3.10/importlib/__pycache__/readers.cpython-310.pyc matches /usr/local/lib/python3.10/importlib/readers.py
< # code object from '/usr/local/lib/python3.10/importlib/__pycache__/readers.cpython-310.pyc'
< import 'importlib.readers' # <_frozen_importlib_external.SourceFileLoader object >
< import 'pkg_resources.extern.jaraco.text' # <_frozen_importlib_external.SourceFileLoader object >
553a492,494
> # /usr/local/lib/python3.10/__pycache__/typing.cpython-310.pyc matches /usr/local/lib/python3.10/typing.py
> # code object from '/usr/local/lib/python3.10/__pycache__/typing.cpython-310.pyc'
> import 'typing' # <_frozen_importlib_external.SourceFileLoader object >
563a505,508
> # /usr/local/lib/python3.10/logging/__pycache__/__init__.cpython-310.pyc matches /usr/local/lib/python3.10/logging/__init__.py
> # code object from '/usr/local/lib/python3.10/logging/__pycache__/__init__.cpython-310.pyc'
> import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
> import 'logging' # <_frozen_importlib_external.SourceFileLoader object >
652a598,615
> # /usr/local/lib/python3.10/concurrent/__pycache__/__init__.cpython-310.pyc matches /usr/local/lib/python3.10/concurrent/__init__.py
> # code object from '/usr/local/lib/python3.10/concurrent/__pycache__/__init__.cpython-310.pyc'
> import 'concurrent' # <_frozen_importlib_external.SourceFileLoader object >
> # /usr/local/lib/python3.10/concurrent/futures/__pycache__/__init__.cpython-310.pyc matches /usr/local/lib/python3.10/concurrent/futures/__init__.py
> # code object from '/usr/local/lib/python3.10/concurrent/futures/__pycache__/__init__.cpython-310.pyc'
> # /usr/local/lib/python3.10/concurrent/futures/__pycache__/_base.cpython-310.pyc matches /usr/local/lib/python3.10/concurrent/futures/_base.py
> # code object from '/usr/local/lib/python3.10/concurrent/futures/__pycache__/_base.cpython-310.pyc'
> import 'concurrent.futures._base' # <_frozen_importlib_external.SourceFileLoader object >
> import 'concurrent.futures' # <_frozen_importlib_external.SourceFileLoader object >
> # /usr/local/lib/python3.10/concurrent/futures/__pycache__/thread.cpython-310.pyc matches /usr/local/lib/python3.10/concurrent/futures/thread.py
> # code object from '/usr/local/lib/python3.10/concurrent/futures/__pycache__/thread.cpython-310.pyc'
> # /usr/local/lib/python3.10/__pycache__/queue.cpython-310.pyc matches /usr/local/lib/python3.10/queue.py
> # code object from '/usr/local/lib/python3.10/__pycache__/queue.cpython-310.pyc'
> # extension module '_queue' loaded from '/usr/local/lib/python3.10/lib-dynload/_queue.cpython-310-x86_64-linux-gnu.so'
> # extension module '_queue' executed from '/usr/local/lib/python3.10/lib-dynload/_queue.cpython-310-x86_64-linux-gnu.so'
> import '_queue' # <_frozen_importlib_external.ExtensionFileLoader object >
> import 'queue' # <_frozen_importlib_external.SourceFileLoader object >
> import 'concurrent.futures.thread' # <_frozen_importlib_external.SourceFileLoader object >
662,674c625
<
<
< ^CException ignored in: <built-in method acquire of _thread.lock object >
< Traceback (most recent call last):
< File "/usr/local/lib/python3.10/site-packages/gevent/os.py", line 431, in fork_and_watch
< pid = fork()
< KeyboardInterrupt:
< Traceback (most recent call last):
< File "//test.py", line 11, in <module>
< fut = executor.submit(subprocess.run, ["ls", "-l", "/dev/null"], capture_output=True)
< File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 162, in submit
< with self._shutdown_lock, _global_shutdown_lock:
< RuntimeError: release unlocked lock
---
> CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0, stdout=b'crw-rw-rw- 1 root root 1, 3 Feb 7 19:04 /dev/null\n', stderr=b'')
913,938d863
< # cleanup[2] removing pkg_resources._vendor.jaraco
< # cleanup[2] removing pkg_resources.extern.jaraco
< # cleanup[2] removing typing
< # destroy typing
< # cleanup[2] removing importlib.abc
< # cleanup[2] removing importlib._adapters
< # cleanup[2] removing importlib._common
< # cleanup[2] removing importlib.resources
< # cleanup[2] removing concurrent
< # destroy concurrent
< # cleanup[2] removing atexit
< # cleanup[2] removing logging
< # cleanup[2] removing concurrent.futures._base
< # cleanup[2] removing concurrent.futures
< # destroy concurrent.futures
< # cleanup[2] removing _queue
< # cleanup[2] removing queue
< # cleanup[2] removing concurrent.futures.thread
< # cleanup[2] removing pkg_resources._vendor.more_itertools.recipes
< # cleanup[2] removing pkg_resources._vendor.more_itertools.more
< # cleanup[2] removing pkg_resources._vendor.more_itertools
< # cleanup[2] removing pkg_resources.extern.more_itertools
< # cleanup[2] removing pkg_resources.extern.jaraco.functools
< # cleanup[2] removing pkg_resources.extern.jaraco.context
< # cleanup[2] removing importlib.readers
< # cleanup[2] removing pkg_resources.extern.jaraco.text
943a869,870
> # cleanup[2] removing typing
> # destroy typing
945a873,874
> # cleanup[2] removing atexit
> # cleanup[2] removing logging
959a889
> # destroy pkg_resources
988a919,926
> # cleanup[2] removing concurrent
> # destroy concurrent
> # cleanup[2] removing concurrent.futures._base
> # cleanup[2] removing concurrent.futures
> # destroy concurrent.futures
> # cleanup[2] removing _queue
> # cleanup[2] removing queue
> # cleanup[2] removing concurrent.futures.thread
995a934,973
> # destroy zipfile
> # destroy pkgutil
> # destroy plistlib
> # destroy tempfile
> # destroy pkg_resources.extern
> # destroy pkg_resources._vendor
> # destroy pathlib
> # destroy bz2
> # destroy lzma
> # destroy zlib
> # destroy _bz2
> # destroy _compression
> # destroy _lzma
> # destroy fnmatch
> # destroy ntpath
> # destroy zipimport
> # destroy pyexpat.errors
> # destroy pyexpat.model
> # destroy pyexpat
> # destroy email.quoprimime
> # destroy email.base64mime
> # destroy email.encoders
> # destroy email._parseaddr
> # destroy email.utils
> # destroy email._policybase
> # destroy email.feedparser
> # destroy email.parser
> # destroy email.header
> # destroy email.charset
> # destroy email
> # destroy email.errors
> # destroy binascii
> # destroy random
> # destroy socket
> # destroy array
> # destroy calendar
> # destroy datetime
> # destroy locale
> # destroy encodings
> # destroy shutil
996a975,977
> # cleanup[3] wiping queue
> # cleanup[3] wiping _queue
> # cleanup[3] wiping concurrent.futures._base
1006,1010d986
< # cleanup[3] wiping pkg_resources
< # destroy pkg_resources._vendor
< # destroy pkgutil
< # destroy plistlib
< # destroy pkg_resources.extern
1011a988,989
> # destroy urllib
> # destroy urllib.parse
1019a998
> # destroy inspect
1023a1003
> # destroy logging
1027a1008,1009
> # destroy struct
> # cleanup[3] wiping atexit
1044,1082d1025
< # cleanup[3] wiping pkg_resources.extern.jaraco.text
< # cleanup[3] wiping importlib.readers
< # destroy zipfile
< # cleanup[3] wiping pkg_resources.extern.jaraco.context
< # cleanup[3] wiping pkg_resources.extern.jaraco.functools
< # destroy inspect
< # destroy pkg_resources
< # cleanup[3] wiping pkg_resources.extern.more_itertools
< # destroy pkg_resources._vendor.more_itertools.recipes
< # destroy pkg_resources._vendor.more_itertools.more
< # cleanup[3] wiping pkg_resources._vendor.more_itertools
< # cleanup[3] wiping queue
< # cleanup[3] wiping _queue
< # cleanup[3] wiping concurrent.futures._base
< # destroy logging
< # cleanup[3] wiping atexit
< # cleanup[3] wiping importlib.resources
< # cleanup[3] wiping importlib._common
< # destroy tempfile
< # cleanup[3] wiping importlib._adapters
< # cleanup[3] wiping importlib.abc
< # cleanup[3] wiping pkg_resources.extern.jaraco
< # destroy pkg_resources.extern.jaraco.functools
< # destroy pkg_resources.extern.jaraco.context
< # destroy pkg_resources.extern.jaraco.text
< # cleanup[3] wiping pkg_resources._vendor.jaraco
< # cleanup[3] wiping email.parser
< # cleanup[3] wiping email.feedparser
< # cleanup[3] wiping email._policybase
< # cleanup[3] wiping email.utils
< # destroy random
< # destroy socket
< # destroy urllib
< # destroy urllib.parse
< # cleanup[3] wiping email._parseaddr
< # destroy calendar
< # cleanup[3] wiping locale
< # destroy encodings
< # cleanup[3] wiping array
1087,1092d1029
< # cleanup[3] wiping email.header
< # cleanup[3] wiping email.charset
< # destroy email
< # cleanup[3] wiping email.encoders
< # cleanup[3] wiping email.base64mime
< # cleanup[3] wiping email.quoprimime
1094,1100d1030
< # cleanup[3] wiping email.errors
< # cleanup[3] wiping xml.parsers.expat.errors
< # cleanup[3] wiping xml.parsers.expat.model
< # cleanup[3] wiping pyexpat
< # destroy pyexpat.errors
< # destroy pyexpat.model
< # cleanup[3] wiping datetime
1102,1104d1031
< # cleanup[3] wiping pathlib
< # cleanup[3] wiping ntpath
< # cleanup[3] wiping struct
1106,1114d1032
< # cleanup[3] wiping shutil
< # destroy fnmatch
< # cleanup[3] wiping lzma
< # cleanup[3] wiping _lzma
< # cleanup[3] wiping bz2
< # destroy _compression
< # cleanup[3] wiping _bz2
< # cleanup[3] wiping zlib
< # cleanup[3] wiping binascii
1116c1034
< # cleanup[3] wiping selectors
---
> # destroy selectors
1166a1085
> # destroy collections.abc
1175,1176d1093
< # destroy importlib._adapters
< # destroy importlib._common
1179,1181d1095
< # destroy importlib.abc
< # destroy importlib.resources
< # destroy importlib.readers
1202,1203d1115
< # cleanup[3] wiping zipimport
< # destroy _frozen_importlib_external
1204a1117
> # cleanup[3] wiping _frozen_importlib_external
1207d1119
< # destroy marshal
1216a1129
> # destroy _socket
1218,1219d1130
< # destroy pkg_resources._vendor.jaraco
< # destroy pkg_resources._vendor.more_itertools
1223a1135,1137
> # destroy _frozen_importlib_external
> # destroy io
> # destroy marshal
1227a1142
> # destroy enum
1232,1234d1146
< # destroy collections.abc
< # destroy operator
< # destroy shutil
1236,1245c1148
< # destroy pathlib
< # destroy bz2
< # destroy lzma
< # destroy ntpath
< # destroy io
< # destroy zlib
< # destroy _bz2
< # destroy _lzma
< # destroy zipimport
< # destroy enum
---
> # destroy operator
1247,1257d1149
< # destroy email.errors
< # destroy email.quoprimime
< # destroy email.base64mime
< # destroy email.encoders
< # destroy email.charset
< # destroy email.header
< # destroy email._parseaddr
< # destroy email.utils
< # destroy email._policybase
< # destroy email.feedparser
< # destroy email.parser
1264,1271d1155
< # destroy pyexpat
< # destroy struct
< # destroy binascii
< # destroy datetime
< # destroy locale
< # destroy _socket
< # destroy selectors
< # destroy array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment