Giter VIP home page Giter VIP logo

Comments (11)

Stewori avatar Stewori commented on August 14, 2024

Is the re.compile failure closer to the root cause than datetime.strptime()? Or how is this change related?

from pytypes.

jolaf avatar jolaf commented on August 14, 2024

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.

Stewori avatar Stewori commented on August 14, 2024

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.

jolaf avatar jolaf commented on August 14, 2024

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.

Stewori avatar Stewori commented on August 14, 2024

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.

Stewori avatar Stewori commented on August 14, 2024

They must have changed something in the inspect module.

from pytypes.

Stewori avatar Stewori commented on August 14, 2024

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.

Stewori avatar Stewori commented on August 14, 2024

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.

Stewori avatar Stewori commented on August 14, 2024

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.

Stewori avatar Stewori commented on August 14, 2024

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.

jolaf avatar jolaf commented on August 14, 2024

Confirmed fixed.

from pytypes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.