[issue30432] FileInput doesn't accept PathLike objects for file names
New submission from Roy Williams: ``` from fileinput import FileInput from pathlib import Path p = Path('.') FileInput(p) ``` Results in: Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/fileinput.py", line 198, in __init__ files = tuple(files) TypeError: 'PosixPath' object is not iterable -- components: IO messages: 294169 nosy: Roy Williams priority: normal severity: normal status: open title: FileInput doesn't accept PathLike objects for file names versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <http://bugs.python.org/issue30432> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30432] FileInput doesn't accept PathLike objects for file names
Changes by Roy Williams : -- pull_requests: +1822 ___ Python tracker <http://bugs.python.org/issue30432> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30432] FileInput doesn't accept PathLike objects for file names
Roy Williams added the comment: @arp11 sorry for the too-minimal repro :D - the issue is with FileInput attempting to cast `files` to a tuple. Instead, if passed a PathLike object FileInput should set `files` to a tuple just as it does with a str. -- ___ Python tracker <http://bugs.python.org/issue30432> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30605] re.compile fails when compiling bytes under `-bb` mode
New submission from Roy Williams: import re re.compile(br'^(.*?)$(?m)') -- components: Regular Expressions messages: 295473 nosy: Roy Williams, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: re.compile fails when compiling bytes under `-bb` mode versions: Python 3.6, Python 3.7 ___ Python tracker <http://bugs.python.org/issue30605> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30605] re.compile fails when compiling bytes under `-bb` mode
Roy Williams added the comment: Repro: ``` import re re.compile(br'^(.*?)$(?m)') ``` Results in ``` Traceback (most recent call last): File "test_compile.py", line 2, in re.compile(br'^(.*?)$(?m)') File "/usr/lib/python3.6/re.py", line 233, in compile return _compile(pattern, flags) File "/usr/lib/python3.6/re.py", line 301, in _compile p = sre_compile.compile(pattern, flags) File "/usr/lib/python3.6/sre_compile.py", line 562, in compile p = sre_parse.parse(p, flags) File "/usr/lib/python3.6/sre_parse.py", line 856, in parse p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, False) File "/usr/lib/python3.6/sre_parse.py", line 415, in _parse_sub itemsappend(_parse(source, state, verbose)) File "/usr/lib/python3.6/sre_parse.py", line 741, in _parse ' (truncated)' if len(source.string) > 20 else '', BytesWarning: str() on a bytes instance ``` -- ___ Python tracker <http://bugs.python.org/issue30605> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30605] re.compile fails when compiling bytes under `-bb` mode
Changes by Roy Williams : -- pull_requests: +2081 ___ Python tracker <http://bugs.python.org/issue30605> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args
New submission from Roy Williams : Repro: ```python from pathlib import Path import subprocess subprocess.run([Path('/bin/ls')]) # Works Fine subprocess.run(Path('/bin/ls')) # Fails ``` The problem seems to originate from here: https://github.com/python/cpython/blob/master/Lib/subprocess.py#L1237-L1240 This file auspiciously avoids importing pathlib, which I'm guessing is somewhat intentional? Would the correct fix be to check for the existence of a `__fspath__` attribute as per https://www.python.org/dev/peps/pep-0519/ ? -- components: Library (Lib) messages: 305663 nosy: Roy Williams priority: normal severity: normal status: open title: subprocess._execute_child doesn't accept a single PathLike argument for args versions: Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue31961> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args
Roy Williams added the comment: Ignore my comment re: pathlib, it looks like PathLike is defined in `os` and not `pathlib`. -- ___ Python tracker <https://bugs.python.org/issue31961> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28288] Expose environment variable for Py_Py3kWarningFlag
Roy Williams added the comment: > What about PYTHON_OPT and allowing to pass any options via an environment > > > variable? There is a number of precedences (gzip, less, etc). > >export PYTHON_OPT="-t -b -3" I'd be open to this, but it seems like a much wider change than something that I'd have time to build in time for Python 2.7.12. I agree that this is a better long term direction (similarly, I'd like to enable the `-bb` flag in Python 3). I'd have to put a bunch of thought into how this would merge with command line flags. > Or PYTHON3COMP[ATIBILITY]? I'm open to whichever. lemburg had suggested `PYTHON3WARNINGS` so that's what I went with. If that's a blocker for this patch happy to change it. -- ___ Python tracker <http://bugs.python.org/issue28288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22294] 2to3 consuming_calls: len, min, max, zip, map, reduce, filter, dict, xrange
Changes by Roy Williams : -- nosy: +Roy Williams ___ Python tracker <http://bugs.python.org/issue22294> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__
New submission from Roy Williams: I am investigating a migration to Python 3, and to facilitate this we are using the -3 flag as decribed here: https://docs.python.org/3/howto/pyporting.html#prevent-compatibility-regressions . When using this flag I encountered some issues inside of mock itself. Python 3 now requires you to implement __hash__ if you implement __eq__. See https://docs.python.org/3.6/reference/datamodel.html#object.%5F%5Fhash%5F%5F . {mock.ANY} # Fine in Python 2, Throws in Python 3 I've created a PR that explicitly sets the __hash__ method on these objects as None to ensure the behavior is consistent in Python 3 as well as Python 2. The folks over at testing-in-python suggested I submit a bug here first and then the fix can be backported to testing-cabal/mock https://github.com/testing-cabal/mock/pull/378 -- components: Library (Lib) messages: 277290 nosy: Roy Williams priority: normal severity: normal status: open title: mock._Any and mock._Call implement __eq__ but not __hash__ versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue28260> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__
Changes by Roy Williams : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue28260> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26219] implement per-opcode cache in ceval
Changes by Roy Williams : -- nosy: +Roy Williams ___ Python tracker <http://bugs.python.org/issue26219> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28263] Python 2.7's `-3` flag warns about __eq__ being implemented without __hash__ even if __hash__ is never accessed.
New submission from Roy Williams: I'm finding the -3 flag to be super useful at identifying problems with code when porting to Python 3. One of the most common failures, however, is "DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x". While implementing __eq__ without implementing __hash__ is very much an anti-pattern, this warning would be much less noisy if it could be thrown at time of access (like the __getslice__ warning) instead of time of declaration. See Also: https://github.com/nedbat/coveragepy/pull/17 http://bugs.python.org/issue28260 -- components: Interpreter Core messages: 277305 nosy: Roy Williams priority: normal severity: normal status: open title: Python 2.7's `-3` flag warns about __eq__ being implemented without __hash__ even if __hash__ is never accessed. type: behavior versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue28263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__
Roy Williams added the comment: Hey Antti My understanding is the version available on PyPi is now a strict backport of what's in Python 3, so they suggested filling the bug in bugs.python.org so it can be backported. http://lists.idyll.org/pipermail/testing-in-python/2016-September/006864.html Thanks, Roy On Sep 25, 2016 4:24 AM, "Antti Haapala" wrote: > > Antti Haapala added the comment: > > So you mean that unittest.mock should explicitly set `__hash__ = None`; > but this is already what the unittest.mock does, in Python 3; there is no > need to set `__hash__ = None`; it is the backport that needs to do this in > order to stay compatible. There is no mock.py in 2.7. > > -- > nosy: +ztane > > ___ > Python tracker > <http://bugs.python.org/issue28260> > ___ > -- ___ Python tracker <http://bugs.python.org/issue28260> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28260] mock._Any and mock._Call implement __eq__ but not __hash__
Roy Williams added the comment: OK, let's close this issue and I'll ping the TIP thread/this issue again. On Sun, Sep 25, 2016, 11:16 AM Ned Batchelder wrote: > > Ned Batchelder added the comment: > > Roy, the code on GitHub isn't a literal copy of the Python 3 code, since > it uses six, "from __future__ import", conditional imports of builtins, and > so on. > > This can be fixed in GitHub. > > -- > > ___ > Python tracker > <http://bugs.python.org/issue28260> > ___ > -- ___ Python tracker <http://bugs.python.org/issue28260> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28279] setuptools failing to read from setup.cfg only in Python 3.6
New submission from Roy Williams: Howdy, I'm attempting to make a change to the mock package in Python (related to http://bugs.python.org/issue28260), and it appears their CI is broken in Python 3.6 only. The problem appears to originate from setuptools, but this only fails in Python 3.6 Here's the last time the mock jobs passed: https://travis-ci.org/testing-cabal/mock/jobs/153850304 Here's where they started failing: https://travis-ci.org/testing-cabal/mock/jobs/159121114 Here's the core of the issue. AFAICT in Python 3.6 setuptools isn't parsing (or is incorrectly parsing) setup.cfg. I filed https://github.com/pypa/setuptools/issues/800 with the PyPA folks, but honestly I am unsure if the issue is Python itself or setuptools. Interestingly, when this build went from "passing" to "failing", both were running Python 3.6.0a4+. 1.43s$ pip install -U .[docs,test] Processing /home/travis/build/testing-cabal/mock mock 2.0.1.dev2 does not provide the extra 'docs' mock 2.0.1.dev2 does not provide the extra 'test' Installing collected packages: mock Found existing installation: mock 2.0.0 Uninstalling mock-2.0.0: Successfully uninstalled mock-2.0.0 Running setup.py install for mock ... done Successfully installed mock-2.0.1.dev2 I attempted to force travis to pin to the latest version of setuptools and had the same issue (only in Python 3.6, not 3.5 - https://travis-ci.org/testing-cabal/mock/builds/162838672) ------ components: Distutils messages: 277434 nosy: Roy Williams, dstufft, eric.araujo priority: normal severity: normal status: open title: setuptools failing to read from setup.cfg only in Python 3.6 versions: Python 3.6 ___ Python tracker <http://bugs.python.org/issue28279> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28279] setuptools failing to read from setup.cfg only in Python 3.6
Changes by Roy Williams : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue28279> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28288] Expose environment variable for Py_Py3kWarningFlag
New submission from Roy Williams: I'm finding the `-3` flag to be super useful, but it's quite a huge pain to thread it through all of the places that spawn python subprocesses, sometimes requiring forking of third party code. This would be much simpler if, like PYTHONWARNINGS, Py_Py3kWarningFlag could be specified as an environment variable. -- components: 2to3 (2.x to 3.x conversion tool) messages: 277522 nosy: Roy Williams priority: normal severity: normal status: open title: Expose environment variable for Py_Py3kWarningFlag type: behavior versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue28288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28288] Expose environment variable for Py_Py3kWarningFlag
Roy Williams added the comment: @Brett @Berker In a similar vein, it'd be great to expose the `-b` flag in Python 3 in a similar manner to test for invalid byte comparisons. -- ___ Python tracker <http://bugs.python.org/issue28288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28288] Expose environment variable for Py_Py3kWarningFlag
Roy Williams added the comment: Thanks for your support! Here's a patch to enable the `PYTHON3WARNINGS` environment variable. -- keywords: +patch Added file: http://bugs.python.org/file44894/pythonenable3kwarningsflag.patch ___ Python tracker <http://bugs.python.org/issue28288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28288] Expose environment variable for Py_Py3kWarningFlag
Changes by Roy Williams : Added file: http://bugs.python.org/file44947/pythonenable3kwarningsflag.patch ___ Python tracker <http://bugs.python.org/issue28288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28288] Expose environment variable for Py_Py3kWarningFlag
Roy Williams added the comment: Thanks for the feedback Berker. I addressed your feedback, but unfortunately I get a 500 from Rietveld when I try to attach a new patchset. I've uploaded the new patchset here. -- ___ Python tracker <http://bugs.python.org/issue28288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28288] Expose environment variable for Py_Py3kWarningFlag
Roy Williams added the comment: Thanks for the feedback Berker! This is my first CPython patch :D. Added in a note in pyporting. I actually did a much more detailed write up here https://gist.github.com/rowillia/c0feed97c1863b2d8e5a3ed73712df65, but it seems a bit verbose for this document. -- Added file: http://bugs.python.org/file44964/pythonenable3kwarningsflag.patch ___ Python tracker <http://bugs.python.org/issue28288> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com