[issue39866] get_type_hints raises inconsistent TypeError
New submission from Joey :
If you pass in an instance of an object without type annotations, you get an
error that states "XXX is not a module, class, method, or function." This
correctly describes the situation
typing.get_type_hints(object())
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.8/typing.py", line 1252, in get_type_hints
raise TypeError('{!r} is not a module, class, method, '
TypeError: is not a module, class, method, or
function.
However, if you pass in an instance of a class that _does_ have type
annotations...
>class Bar:
...foo: int
>typing.get_type_hints(Bar())
{'foo': }
You don't get an error even though the message of the first exception would
suggest you do.
Fix should be pretty easy, either just have the get_type_hints always return a
dictionary, and return an empty dictionary if the type of the object has no
__annotations__ defined (my preferred solution), or actually check to see if
the object is an instance of `_allowed_types` before checking whether the
object has annotations.
--
components: Library (Lib)
messages: 363450
nosy: j.tran4418
priority: normal
severity: normal
status: open
title: get_type_hints raises inconsistent TypeError
versions: Python 3.6, Python 3.7, Python 3.8
___
Python tracker
<https://bugs.python.org/issue39866>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4215] Running Python 2.6 GUI on Windows Vista
New submission from Joey Pallaria <[EMAIL PROTECTED]>: I installed Python 2.6 a few days ago and tried to launch the Python IDLE GUI application. Nothing happened. I've read a couple issues about previous versions of Python IDLE not working on Windows Vista. and they recommended deleting the .idlerc folder in the user directory as well as disabling the UAC (User Account Control) I've done both of these, but i still can't manage to get IDLE to run, any help would be greatly appreciated. -- components: IDLE messages: 75267 nosy: Elushin severity: normal status: open title: Running Python 2.6 GUI on Windows Vista type: behavior versions: Python 2.6 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4215> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30511] shutil.make_archive should not need to chdir (alternatively: make shutil.make_archive thread-safe)
Joey Harrington added the comment: It would be nice if there was at least a warning in the docs that make_archive is not thread-safe, and that if you have two threads creating archives that it's extremely likely you'll get erroneous results since the race condition lasts for the entire duration of the archive creation. -- nosy: +Joey Harrington ___ Python tracker <http://bugs.python.org/issue30511> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31056] Import Module Not Working According To Documentation Python 3.6.2
New submission from Joey DiGiorgio: I am running Windows 7 and Python 3.6.2 trying to import module A from withing module B where both Module A and B are located in the same directory. I get the ModuleNotFoundError. I try the exact same setup with Python 3.5.2 and get no errors and I get the expected behavior. For more details about the exact process I went through and everything I tried, see the StackOverflow post I made about it here: https://stackoverflow.com/questions/45336678/python-3-import-module-not-working-according-to-docs?noredirect=1#comment77637921_45336678 -- components: Windows messages: 299316 nosy: MrJman006, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Import Module Not Working According To Documentation Python 3.6.2 type: crash versions: Python 3.6 ___ Python tracker <http://bugs.python.org/issue31056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31056] Import Module Not Working According To Documentation Python 3.6.2
Joey DiGiorgio added the comment: I will mark the question appropriately as python3. I don't fully understand your comment about venv. If you mean virtual environment or something, that is not the case. I am running an a standard Windows 7 install with Python3 as the only Python install on my path (I used the embedded zip package). I did print sys.path and got the value of "WorkingDir" which is what I expected. I am running Python 3 from within "WorkingDir" and only trying to import a module that is within "WorkingDir". -- ___ Python tracker <http://bugs.python.org/issue31056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31056] Import Module Not Working According To Documentation Python 3.6.2
Joey DiGiorgio added the comment: I understand your comments. I will be at computer that has not ever had Python installed in about an hour and will try it there to see if I can produce an example showing the issue. I just found it weird that Python 3.5.2 worked just fine in the same environment using exactly the same steps with only the system path environment variable changed. That is why I filed this issue. I will report back. -- ___ Python tracker <http://bugs.python.org/issue31056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31056] Import Module Not Working According To Documentation Python 3.6.2
Joey DiGiorgio added the comment: I have tried from 3 computers now and have been able to reproduce the issue with the same set of files described in my stackoverflow post. Here is a .zip package with all of the files I used in all 3 tests. The python package is the Windows 32bit embedded zip package downloaded from the Python site. https://drive.google.com/file/d/0B0tT3_X-iMNzY2VMTkQ4X04zNWM/view?usp=sharing -- ___ Python tracker <http://bugs.python.org/issue31056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31056] Import Module Not Working According To Documentation Python 3.6.2
Joey DiGiorgio added the comment: I run the test.bat file and get the import error. -- ___ Python tracker <http://bugs.python.org/issue31056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31056] Import Module Not Working According To Documentation Python 3.6.2
Joey DiGiorgio added the comment: Steve Dower, I understand the purpose of the embedded package. The test was also tried by calling the python executable without modifying the path and the same thing happens. i.e. %~dp0\Python_Embedded_Windows_32bit_v3.6.2\python main.py in the zip package I provided. -- ___ Python tracker <http://bugs.python.org/issue31056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31056] Import Module Not Working According To Documentation Python 3.6.2
Joey DiGiorgio added the comment: Ok I have downloaded an installed via the Windows installer and the test I run works as expected. I also tried the embedded package without the ._pth and it also works according to the embedded documentation. Sorry for the confusion as I did not specify the embedded package from what I can tell. Thank you all for working with me on resolving this. -- ___ Python tracker <http://bugs.python.org/issue31056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15068] fileinput requires two EOF when reading stdin
Joey Geralnik added the comment: First off, I'm a complete noob looking at the python source code for the first time so forgive me if I've done something wrong. What if the length of the chunk is checked as well? The following code works fine: import sys while True: chunk = sys.stdin.read(1000) if not chunk: break # process if len(chunk) < 1000: break Something similar could be done in the fileinput class. The patch I've attached checks if the number of bytes read from the file is less than the size of the buffer (which means that the file has ended). If so, the next time the file is to be read it skips to the next file instead. joey@j-Laptop:~/cpython$ ./python Python 3.3.0a3+ (default:befd56673c80+, Jun 15 2012, 17:14:12) [GCC 4.6.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import fileinput [73732 refs] >>> lines = list(fileinput.input()) foo bar ^D [73774 refs] >>> lines ['foo\n', 'bar\n'] [73780 refs] -- keywords: +patch nosy: +jgeralnik Added file: http://bugs.python.org/file26018/fileinput.patch ___ Python tracker <http://bugs.python.org/issue15068> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15068] fileinput requires two EOF when reading stdin
Joey Geralnik added the comment: But this is calling the readlines function, which continually reads from the file until more bytes have been read than the specified argument. >From bz2.readlines: "size can be specified to control the number of lines read: no further lines will be read once the total size of the lines read so far equals or exceeds size." Do other file-like objects interpret this parameter differently? -- ___ Python tracker <http://bugs.python.org/issue15068> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15068] fileinput requires two EOF when reading stdin
Joey Geralnik added the comment: Forget other filelike objects. The FileInput class only works with actual files, so the readlines function should always return at least as many bytes as its first parameter. Is this assumption wrong? -- ___ Python tracker <http://bugs.python.org/issue15068> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
