Comments (11)
Is the re.compile
failure closer to the root cause than datetime.strptime()
? Or how is this change related?
from pytypes.
Yes, it's closer.
I've noticed that datetime.strptime()
fails on re.compile()
and reproduced the same problem on a more narrow test.
from pytypes.
It looks like I cannot reproduce this issue using the master branch. You are using the latest release, right? Master had some significant improvements, however the tedious progress in Python 3.7 support is blocking the next release. Maybe some of these improvements fixed it? Anyway, it would be good if you could confirm the one or other way.
from pytypes.
I'm using freshly built master branch on Ubuntu:
$ cat /etc/issue
Ubuntu 18.04.3 LTS \n \l
$ uname -a
Linux rudtzakhavas0 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ git pull
Already up to date.
$ git show-branch
[master] Fixes #63
$ sudo python3 setup.py install
running install
running bdist_egg
running egg_info
writing pytypes.egg-info/PKG-INFO
writing dependency_links to pytypes.egg-info/dependency_links.txt
writing entry points to pytypes.egg-info/entry_points.txt
writing requirements to pytypes.egg-info/requires.txt
writing top-level names to pytypes.egg-info/top_level.txt
writing manifest file 'pytypes.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/type_util.py -> build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/util.py -> build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/stubfile_2_converter.py -> build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/exceptions.py -> build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/typechecker.py -> build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/__init__.py -> build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/stubfile_manager.py -> build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/typelogger.py -> build/bdist.linux-x86_64/egg/pytypes
copying build/lib/pytypes/typecomment_parser.py -> build/bdist.linux-x86_64/egg/pytypes
byte-compiling build/bdist.linux-x86_64/egg/pytypes/type_util.py to type_util.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pytypes/util.py to util.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pytypes/stubfile_2_converter.py to stubfile_2_converter.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pytypes/exceptions.py to exceptions.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pytypes/typechecker.py to typechecker.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pytypes/__init__.py to __init__.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pytypes/stubfile_manager.py to stubfile_manager.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pytypes/typelogger.py to typelogger.cpython-36.pyc
byte-compiling build/bdist.linux-x86_64/egg/pytypes/typecomment_parser.py to typecomment_parser.cpython-36.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pytypes.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pytypes.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pytypes.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pytypes.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pytypes.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pytypes.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
pytypes.__pycache__.stubfile_2_converter.cpython-36: module MAY be using inspect.findsource
pytypes.__pycache__.stubfile_manager.cpython-36: module references __file__
pytypes.__pycache__.typechecker.cpython-36: module MAY be using inspect.stack
pytypes.__pycache__.typelogger.cpython-36: module references __file__
pytypes.__pycache__.typelogger.cpython-36: module MAY be using inspect.findsource
pytypes.__pycache__.util.cpython-36: module references __file__
pytypes.__pycache__.util.cpython-36: module MAY be using inspect.stack
creating 'dist/pytypes-1.0b5.post20-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pytypes-1.0b5.post20-py3.6.egg
removing '/usr/local/lib/python3.6/dist-packages/pytypes-1.0b5.post20-py3.6.egg' (and everything under it)
creating /usr/local/lib/python3.6/dist-packages/pytypes-1.0b5.post20-py3.6.egg
Extracting pytypes-1.0b5.post20-py3.6.egg to /usr/local/lib/python3.6/dist-packages
pytypes 1.0b5.post20 is already the active version in easy-install.pth
Installing typestubs script to /usr/local/bin
Installed /usr/local/lib/python3.6/dist-packages/pytypes-1.0b5.post20-py3.6.egg
Processing dependencies for pytypes==1.0b5.post20
Finished processing dependencies for pytypes==1.0b5.post20
$ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytypes
>>> pytypes
<module 'pytypes' from '/usr/local/lib/python3.6/dist-packages/pytypes-1.0b5.post20-py3.6.egg/pytypes/__init__.py'>
from pytypes.
Okay, this seems to depend strictly on the python version. I can reproduce it with 3.6.1 but not with 3.5 and interestingly also not with 3.6.0.
from pytypes.
They must have changed something in the inspect module.
from pytypes.
In Python 3.6.1+, _get_typestrings
is sometimes called with slot_wrapper objects which seems not to be the case up to 3.6.0. If it just returns None
in slot_wrapper case that seems to fix the issue. But I'm not sure if that is the proper resolution. However, at least in your example, the slot_wrapper objects show up in addition to the function objects it receives in 3.6.0. So at least nothing is "lost" this way.
from pytypes.
Can a slot wrapper contain a type string anyway? I think slots are something implemented on C-level and can only carry type information via stub files. But I'm not sure if __slots__
can introduce slot wrappers backed by actual Python code.
from pytypes.
From https://stackoverflow.com/questions/10401935/python-method-wrapper-type/19545928#19545928 I conclude that slot wrappers need not be searched for type strings.
from pytypes.
This issue can be provoked by
import pytypes
pytypes.has_type_hints(int.__and__)
even in Python 2.7, however still not in Python 3 versions before 3.6.1.
This is more convenient for testing than involving re
into the tests.
from pytypes.
Confirmed fixed.
from pytypes.
Related Issues (20)
- Utility to validate stubfile signatures against .py implementations HOT 4
- pytypes is_of_type: counter-intuitive result on semi-primitive types like list and dict HOT 5
- is_of_type does not work as expected with Annotated[Generic[T], ...] HOT 1
- Some differences between Python 3.6 and 3.8 HOT 3
- New release HOT 1
- please improve error messages when functions decorated with @typechecked are called with incorrect types
- pytypes breaks @autoreload in a somewhat dangerous way HOT 8
- `is_subtype` fails with `List[TypeVar]`
- Infer return type of generic functions based on input
- Support Python 3.10 HOT 7
- @typechecked fails to correctly parse functions with PEP 3102
- Incorrect collections imports in type_util.py HOT 1
- VSCode incorrect decorated func hint HOT 7
- AttributeError: 'NoneType' object has no attribute '__bound__' HOT 5
- Partially-annotated functions with default parameter values result in errors. HOT 12
- Error in @typechecked with List[Dict[str, str]] HOT 1
- Remove backports.typing usage
- _check_caller_type can be broken by removing a blank line in typechecker_testhelper_py3.py
- typechecked(string) should have more consistent return type HOT 1
- Python 3.8 Compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytypes.