[issue33944] Deprecate and remove pth files

2019-02-28 Thread Anthony Sottile
Anthony Sottile added the comment: > contain features we all want to get rid of I don't think even this is unanimous. Things like registering codecs, instrumenting coverage in subprocesses, etc. all seem like legitimate uses of the arbitrary code execution

[issue33944] Deprecate and remove pth files

2019-02-28 Thread Anthony Sottile
Anthony Sottile added the comment: > What I think Anthony is looking for are ways to register “start up functions” > that get executed automatically when the Python interpreter starts up yes, this is what I want to still exist :) my hope is that there's a clear standards-track

[issue33944] Deprecate and remove pth files

2019-03-01 Thread Anthony Sottile
Anthony Sottile added the comment: I don't have time to look through the data today but I wrote a script to collect the usages of `.pth` from pypi. I realized after I ran it that I skipped source distributions with `.zip` extension but otherwise it's pretty complete: https://

[issue33944] Deprecate and remove pth files

2019-03-06 Thread Anthony Sottile
Anthony Sottile added the comment: I did my best to classify those on pypi that were using `.pth` files. My initial search had quite a few false positives (and now that I look at it, completely missed `.zip`-based source distributions so there's likely some false negatives as well) H

[issue33944] Deprecate and remove pth files

2019-03-06 Thread Anthony Sottile
Anthony Sottile added the comment: > > There was a single .pth file that I deemed "malicious" since it completely breaks the `subprocess` module (`subprocess-run`) > > It only seems to set an attribute. What's wrong with that? Does the early import of subprocess

[issue33944] Deprecate and remove pth files

2019-03-06 Thread Anthony Sottile
Anthony Sottile added the comment: > Doesn’t that kind of prove my point? :) It's not any worse than gevent ~breaking~ monkeypatching almost the entire standard library. And to be fair to the author, it was created well before (2013-06-21) python3.5's `run` api existed (2015

[issue33944] Deprecate and remove pth files

2019-03-07 Thread Anthony Sottile
Anthony Sottile added the comment: I think nearly all of the use cases in the packages are valid (except module-layout) -- or at least if this feature were removed without having a startup-time site-packages code execution feature there would be no possible replacement. I'll elabor

[issue33944] Deprecate and remove pth files

2019-03-07 Thread Anthony Sottile
Anthony Sottile added the comment: > What I'm dismissing is that "pip install some-package" can define a global > startup task for your interpreter. I shouldn't get debugging or code coverage > enabled every time I run "python" just because I installed

[issue33944] Deprecate and remove pth files

2019-03-07 Thread Anthony Sottile
Anthony Sottile added the comment: >>> I should have to start that package somehow. >> >> `pip install` is a pretty good opt-in already imo > > Except that it conflates responsibilities. I may not want to opt into > coverage even being loaded in my application b

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-11 Thread Anthony Sottile
New submission from Anthony Sottile : The current code for `os.path.expanduser` in `ntpath` uses `HOME` in preference to `USERPROFILE` / `HOMEDRIVE\\HOMEPATH` I can't find any documentation of `HOME` being relevant on windows (only on posix). For example, wikipedia only men

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-11 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +12262 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36264> ___ _

[issue36264] os.path.expanduser should not use HOME on windows

2019-03-12 Thread Anthony Sottile
Anthony Sottile added the comment: > Modifying this value could have a real impact on the rest of the process, so > we should be very careful to undo it regardless of test result. (Modifying > HOME is not a as big a deal since, as you point out, it's not "real" ;) )

[issue36478] backport of pickle fixes to Python 3.5.7 uses C99 for loops

2019-03-29 Thread Anthony Sottile
New submission from Anthony Sottile : While building python 3.5.7 for https://github.com/deadsnakes ../Modules/_pickle.c: In function 'PyMemoTable_Copy': ../Modules/_pickle.c:677:5: error: 'for' loop initial declarations are only allowed in C99 mode for (si

[issue36478] backport of pickle fixes to Python 3.5.7 uses C99 for loops

2019-03-29 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +12556 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36478> ___ _

[issue2180] tokenize: mishandles line joining

2019-04-07 Thread Anthony Sottile
Anthony Sottile added the comment: Here's an example in the wild which still reproduces with python3.8a3: https://github.com/SecureAuthCorp/impacket/blob/194b22ed2fc85c4f241375fb7ebe4e0d89626c8c/impacket/examples/remcomsvc.py#L1669 This was reported as a bug on flake8: https://gitla

[issue36478] backport of pickle fixes to Python 3.5.7 uses C99 for loops

2019-04-08 Thread Anthony Sottile
Anthony Sottile added the comment: It's a rather oldish gcc in this case. (4.8.4 + whatever ubuntu patches). Here's a full (successful) build log (including the combinations of flags) after patching: https://launchpadlibrarian.net/416985438/buildlog_ubuntu-trusty-amd64.python3

[issue34850] Emit a syntax warning for "is" with a literal

2019-04-13 Thread Anthony Sottile
Anthony Sottile added the comment: Should this also produce warnings for `list` / `dict` / `set` literals? ``` $ python3.8 Python 3.8.0a3 (default, Mar 27 2019, 03:46:44) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more

[issue36844] abiflag `m` is no longer showing when compiled with --enable-shared

2019-05-07 Thread Anthony Sottile
New submission from Anthony Sottile : This appears to be a regression between 3.8a3 and 3.8a4 -- though it may be intentional and I'm missing something? I noticed this while packaging 3.8 for deadsnakes https://github.com/deadsnakes/python3.8 I've created a minimal reproductio

[issue36844] abiflag `m` is no longer showing when compiled with --enable-shared

2019-05-07 Thread Anthony Sottile
Anthony Sottile added the comment: +vstinner Hmmm, actually the relevant commit appears to be 6c44fde3e03079e0c69f823dafbe04af50b5bd0d and intentional (I ran a git bisect to find this!) https://github.com/python/cpython/pull/12931 Does PEP 3149 require an update with this change, it still

[issue36844] abiflag `m` is no longer showing when compiled with --enable-shared

2019-05-07 Thread Anthony Sottile
Anthony Sottile added the comment: seems intentional => closing -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Anthony Sottile
New submission from Anthony Sottile : More fallout from the Constant change in https://bugs.python.org/issue32892 minimal reproduction: import ast class V(ast.NodeVisitor): def visit_Str(self, node): print(node.s) def main(): V().visit(ast.parse('x = "hi"&#

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Anthony Sottile
Anthony Sottile added the comment: wrong bpo, this is the right one: https://bugs.python.org/issue32892 -- ___ Python tracker <https://bugs.python.org/issue36

[issue32892] Remove specific constant AST types in favor of ast.Constant

2019-05-14 Thread Anthony Sottile
Anthony Sottile added the comment: hitting this in https://bugs.python.org/issue36917? Is the simplification here really worth the breaking change to consumers? I now have to write something that's essentially this to work around this which feels more like the complexity has just

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-14 Thread Anthony Sottile
Anthony Sottile added the comment: There would still be a breakage for that if someone was defining py36+ `visit_Constant` (which would clobber the `ast.NodeVisitor.visit_Constant` if we were to add it) -- ___ Python tracker <ht

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Anthony Sottile
Anthony Sottile added the comment: spent some more time thinking about this and I think we should strongly consider reverting. simplification in the core interpreter should not be weighed lightly against complexity and breaking changes for users. the change is also unfortunate because it

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Anthony Sottile
Anthony Sottile added the comment: The simplest case is just the addition of an `isinstance` check: https://github.com/asottile/dead/blob/85f5edbb84b5e118beab4be3346a630e41418a02/dead.py#L165-L170 class V(ast.NodeVisitor): def visit_Str(self, node): ... def visit_Constant

[issue36917] ast.NodeVisitor no longer calls visit_Str

2019-05-15 Thread Anthony Sottile
Anthony Sottile added the comment: > You can not use the same implementation of the visitor for Num, Str, > NameConstant and Ellipsis, because all these classes use different attribute > for saving the value ah yes, this is true -- maybe the better change would be to just add `

[issue32539] os.listdir(...) on deep path on windows in python2.7 fails with errno 123

2018-01-12 Thread Anthony Sottile
New submission from Anthony Sottile : On windows, a deep path can be accessed by prefixing the path with \\?\ https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx?f=255&MSPPError=-2147217396#maxpath The call to `listdir()` fails because it uses a posix separator

[issue32539] os.listdir(...) on deep path on windows in python2.7 fails with errno 123

2018-01-12 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +5023 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32539> ___ ___ Py

[issue30945] loop.create_server does not detect if the interface is IPv6 enabled

2018-02-09 Thread Anthony Sottile
Anthony Sottile added the comment: Seeing this as well when running the cpython test suite in docker: ``` $ ./python -m test.test_asyncio ... [18 similar traces omitted] == ERROR: test_sock_sendfile_zero_size

[issue30945] loop.create_server does not detect if the interface is IPv6 enabled

2018-02-09 Thread Anthony Sottile
Anthony Sottile added the comment: Actually, my issue seems to be something more strange. The host being passed in is `localhost` which resolves to: ``` >>> pprint.pprint(socket.getaddrinfo('localhost', 80)) [(, , 6, '', ('127.0.0.1', 80)),

[issue30945] loop.create_server does not detect if the interface is IPv6 enabled

2018-02-09 Thread Anthony Sottile
Anthony Sottile added the comment: Applying this patch makes the tests pass for me, but I don't think the patch is appropriate (just hides the bug): ``` $ git diff diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py index 5bd76d3..ff6c4e1 1

[issue16806] col_offset is -1 and lineno is wrong for multiline string expressions

2018-03-01 Thread Anthony Sottile
Anthony Sottile added the comment: Still a problem in 3.7: $ python3.7 Python 3.7.0b2 (default, Feb 28 2018, 06:59:18) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ast &g

[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-19 Thread Anthony Sottile
Change by Anthony Sottile : -- pull_requests: +5909 ___ Python tracker <https://bugs.python.org/issue31550> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-19 Thread Anthony Sottile
Anthony Sottile added the comment: I made a new PR which instead *reverts* the python2.7 patch to restore consistency -- ___ Python tracker <https://bugs.python.org/issue31

[issue31550] Inconsistent error message for TypeError with subscripting

2018-03-19 Thread Anthony Sottile
Anthony Sottile added the comment: I think the main concern here is ease in portability coupled with the incorrectness of the current message (pointed out in https://bugs.python.org/issue31550#msg302738) For instance it was consistent in 2.7.1, but not later on in the 2.7.x tree. *And

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Anthony Sottile
Anthony Sottile added the comment: The intention of the change in issue 26510 was to pick the least surprising behaviour for the default value of subparsers -- the compatiblity with the behaviour before the regression was introduced in 3.3 was a nice side-effect. As with the rest of

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Anthony Sottile
Anthony Sottile added the comment: Grabbed the wrong SO link, I believe this is the one I meant to link to: https://stackoverflow.com/a/18283730/812183 -- ___ Python tracker <https://bugs.python.org/issue33

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Anthony Sottile
Anthony Sottile added the comment: Yeah, I picked the default value `True` because I couldn't actually find a user of subparsers that _wanted_ optional subparsers. ¯\_(ツ)_/¯ -- ___ Python tracker <https://bugs.python.org/is

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-15 Thread Anthony Sottile
Anthony Sottile added the comment: According to the other bugs, the change in 3.3 was an inadvertent regression. The fact that it didn't get fixed for so long is mostly due to the unmaintained state of argparse in the stdlib. The change in behaviour here is the _fix_ of that regre

[issue31550] Inconsistent error message for TypeError with subscripting

2017-09-24 Thread Anthony Sottile
Anthony Sottile added the comment: Shouldn't you wait for Raymond's arguments before outright closing the PR? -- ___ Python tracker <https://bugs.python.o

[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2017-11-03 Thread Anthony Sottile
New submission from Anthony Sottile : Fortunately, this can be reproduced with the testsuite: ``` == ERROR: test_copystat_symlinks (__main__.TestShutil

[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2017-11-03 Thread Anthony Sottile
Anthony Sottile added the comment: Here's one idea for a patch (inspired by the rest of the function): ``` diff --git a/Lib/shutil.py b/Lib/shutil.py index 464ee91..2099289 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -213,6 +213,13 @@ def copystat(src, dst, *, follow_symlinks

[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2017-11-03 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +4230 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue31940> ___ ___ Py

[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2017-12-10 Thread Anthony Sottile
Change by Anthony Sottile : -- pull_requests: +4684 ___ Python tracker <https://bugs.python.org/issue31940> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32277] SystemError via chmod(symlink, ..., follow_symlinks=False)

2017-12-11 Thread Anthony Sottile
New submission from Anthony Sottile : While investigating https://bugs.python.org/issue31940 I noticed the following is raised as `SystemError` instead of the expected `NotImplementedError` (note: you need a platform with fchmodat but does not support nofollow) ``` touch foo ln -s foo bar

[issue32277] SystemError via chmod(symlink, ..., follow_symlinks=False)

2017-12-11 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +4696 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32277> ___ ___ Py

[issue32277] SystemError via chmod(symlink, ..., follow_symlinks=False)

2017-12-11 Thread Anthony Sottile
Anthony Sottile added the comment: I noticed it when I changed the test preconditions in https://github.com/python/cpython/pull/4783 I tried changing a test to trigger this (in this branch) but I found I was just implementing exactly the test in the `skip` condition which to me didn't

[issue31940] copystat on symlinks fails for alpine -- faulty lchmod implementation?

2017-12-15 Thread Anthony Sottile
Anthony Sottile added the comment: if I'm reading the manpage correctly: `readlink` tells the filename that the symlink points to. lchmod is concerned with setting the `stat` on the link itself (which only some platforms actually su

[issue30697] segfault in PyErr_NormalizeException() after memory exhaustion

2017-12-19 Thread Anthony Sottile
Anthony Sottile added the comment: Should this have landed in python3.6? It removes a public symbol `PyExc_RecursionErrorInst` (abi break?) -- nosy: +Anthony Sottile ___ Python tracker <https://bugs.python.org/issue30

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-16 Thread Anthony Sottile
Anthony Sottile added the comment: Considering the huge popularity of these SO questions, I don't think this should be reverted: - https://stackoverflow.com/questions/23349349/argparse-with-required-subparser - https://stackoverflow.com/questions/22990977/why-does-this-argparse-code-b

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Anthony Sottile
Anthony Sottile added the comment: Is there then no pathway for actually fixing the bug? aka how can I get `required=True` to be the default. -- ___ Python tracker <https://bugs.python.org/issue33

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Anthony Sottile
Anthony Sottile added the comment: That's a separate issue (also a bug introduced by the bad 3.3 patch): https://bugs.python.org/issue29298 I have an open PR to fix it as well but it has not seen review action: https://github.com/python/cpython/pull

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Anthony Sottile
Anthony Sottile added the comment: The bug is orthogonal, you can trigger it without the `required=` keyword argument via the (currently suggested) monkeypatch workaround which restores the pre-3.3 behaviour: import argparse parser = argparse.ArgumentParser() subp = parser.add_subparsers

[issue17909] Autodetecting JSON encoding

2018-06-03 Thread Anthony Sottile
Change by Anthony Sottile : -- pull_requests: +6992 ___ Python tracker <https://bugs.python.org/issue17909> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23835] configparser does not convert defaults to strings

2018-07-02 Thread Anthony Sottile
Anthony Sottile added the comment: Unclear if this regression (from this patch) is intentional or not: ``` $ python3.6 -c 'import configparser; configparser.ConfigParser(defaults={"a": None})' $ python3.7 -c 'import configparser; configparser.ConfigParser(defaults

[issue19891] Exiting Python REPL prompt with user without home directory throws error in atexit._run_exitfuncs

2018-07-26 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +8005 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue19891> ___ ___ Py

[issue19891] Exiting Python REPL prompt with user without home directory throws error in atexit._run_exitfuncs

2018-07-26 Thread Anthony Sottile
Anthony Sottile added the comment: I was able to reproduce both the `PermissionError` and the `FileNotFoundError` under these circumstances: $ docker run --user 123:123 -ti python python Python 3.7.0 (default, Jul 17 2018, 11:04:33) [GCC 6.3.0 20170516] on linux Type "help",

[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2018-10-12 Thread Anthony Sottile
Change by Anthony Sottile : -- nosy: +Anthony Sottile ___ Python tracker <https://bugs.python.org/issue12782> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35001] ImportFrom level cannot be optional

2018-10-16 Thread Anthony Sottile
Anthony Sottile added the comment: It appears it has always had this bug since introduction of absolute/relative imports in https://github.com/python/cpython/commit/f7f438ba3b05eb4356e7511401686b07d9dfb6d8 Agree with changing this to `# type: int` and correcting the documentation

[issue35001] ImportFrom level cannot be optional

2018-10-16 Thread Anthony Sottile
Anthony Sottile added the comment: In fact, trying to use an `ImportFrom` without an integer `level` results in a `ValueError`: >>> x = ast.parse('from os import path') >>> x.body[0].level = None >>> compile(x, '', 'exec') Traceback (

[issue35004] Odd behavior when using datetime.timedelta under cProfile

2018-10-16 Thread Anthony Sottile
Anthony Sottile added the comment: Here's a simpler reproduction without involving a third party library: >>> import cProfile >>> from datetime import timedelta >>> pr = cProfile.Profile() >>> timedelta.total_seconds(-25200) Traceback (most recent cal

[issue35001] ImportFrom level cannot be optional

2018-10-16 Thread Anthony Sottile
Anthony Sottile added the comment: Hmmm, I don't think mypy has an annotation for "sometimes has an attribute" -- `Optional[T]` is `Union[T, None]` (why I tried `None`). But you're right, `FromImport` is constructable without a `level` -- it seems to behave as `level=0`

[issue16806] col_offset is -1 and lineno is wrong for multiline string expressions

2018-10-20 Thread Anthony Sottile
Change by Anthony Sottile : -- pull_requests: +9361 ___ Python tracker <https://bugs.python.org/issue16806> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33899] Tokenize module does not mirror "end-of-input" is newline behavior

2018-10-21 Thread Anthony Sottile
Anthony Sottile added the comment: This change in behaviour is breaking pycodestyle: https://github.com/PyCQA/pycodestyle/issues/786 Perhaps it shouldn't have been backported (especially all the way to python2.7?) -- nosy: +Anthony So

[issue33899] Tokenize module does not mirror "end-of-input" is newline behavior

2018-10-21 Thread Anthony Sottile
Anthony Sottile added the comment: I'm surprised this was classified as a bug! Though that's subjective so I get that it's difficult to decide what is and what isn't ¯\(ツ)/¯ -- ___ Python tracker <https://bug

[issue33944] Deprecate and remove pth files

2018-10-27 Thread Anthony Sottile
Change by Anthony Sottile : -- nosy: +Anthony Sottile ___ Python tracker <https://bugs.python.org/issue33944> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34364] problem with traceback for syntax error in f-string

2018-10-28 Thread Anthony Sottile
Change by Anthony Sottile : -- keywords: +patch pull_requests: +9494 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue1154351] add get_current_dir_name() to os module

2018-10-28 Thread Anthony Sottile
Anthony Sottile added the comment: Does this actually make sense for the `os` module? `PWD` is a variable set by your interactive shell and doesn't really make sense outside that context. I expect this function to be too easily confused with `os.getcwd()` and a source of bugs whe

[issue35137] Exception in isinstance when __class__ property raises

2018-11-01 Thread Anthony Sottile
New submission from Anthony Sottile : This may be intentional, but the behaviour changed between python2 and python3. Want to make sure it's intentional as we're working (hacking) around this in pytest: https://github.com/pytest-dev/pytest/pull/4284 The actual impact on pytest is

[issue35137] Exception in isinstance when __class__ property raises

2018-11-01 Thread Anthony Sottile
Anthony Sottile added the comment: arbitrary, sure, but deriving from `Exception` maybe? -- ___ Python tracker <https://bugs.python.org/issue35137> ___ ___ Pytho

[issue20094] intermitent failures with test_dbm

2017-01-09 Thread Anthony Sottile
Anthony Sottile added the comment: I'm seeing this same failure in python3.5 on 16.04 about 20% of the time: ``` $ python3.5 -m test -v test_dbm == CPython 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] == Linux-4.4.0-57-generic-x86_64-with-Ubuntu-16.04-xenial little-e

[issue20094] intermitent failures with test_dbm

2017-01-09 Thread Anthony Sottile
Anthony Sottile added the comment: Stepping through the code, it seems under ndbm it is creating a file with a '.db' extension: ``` (Pdb) list 47 'g': b'intended', 48 } 49 50 def init_db(self): 51 i

[issue20094] intermitent failures with test_dbm

2017-01-09 Thread Anthony Sottile
Anthony Sottile added the comment: That doesn't seem to be the problem though, that occurs in both the successful and failure case -- ___ Python tracker <http://bugs.python.org/is

[issue28700] test_dbm failure: KeyError: b'0' (intermittent in 3.5, reliable in 3.6)

2017-01-09 Thread Anthony Sottile
Changes by Anthony Sottile : -- nosy: +Anthony Sottile ___ Python tracker <http://bugs.python.org/issue28700> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue29258] __init__.py required for pkgutil.walk_packages in python3

2017-01-12 Thread Anthony Sottile
New submission from Anthony Sottile: PEP420 makes __init__.py files optional: https://docs.python.org/3/whatsnew/3.3.html#pep-420-implicit-namespace-packages Though it seems without them, pkgutil.walk_packages does not function as desired: https://docs.python.org/3/library/pkgutil.html

[issue16806] col_offset is -1 and lineno is wrong for multiline string expressions

2015-02-05 Thread Anthony Sottile
Changes by Anthony Sottile : -- nosy: +asottile ___ Python tracker <http://bugs.python.org/issue16806> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16806] col_offset is -1 and lineno is wrong for multiline string expressions

2015-02-05 Thread Anthony Sottile
Anthony Sottile added the comment: Any updates on this? I'm running into this as well (still a problem in 3.4) ```$ python3.4 Python 3.4.2 (default, Oct 11 2014, 17:59:27) [GCC 4.4.3] on linux Type "help", "copyright", "credits" or "license" for m

[issue25815] Improper subprocess output of arguments with braces in them on windows

2015-12-06 Thread Anthony Sottile
New submission from Anthony Sottile: First some expected output: ``` # from cmd.exe C:\Users\Anthony>echo hi{1} hi{1} # from MINGW $ echo hi{1} hi{1} ``` ``` # On ubuntu $ echo 'hi{1}' hi{1} $ python3.5 -c "import subprocess; print(subprocess.check_output(('echo&#

[issue25815] Improper subprocess output of arguments with braces in them on windows

2015-12-06 Thread Anthony Sottile
Anthony Sottile added the comment: It *is* in my path (otherwise it wouldn't produce any output at all). I'm not trying to use the shell builtin, I'm trying to use the executable. -- resolution: not a bug -> status: closed -> open _

[issue25815] Improper subprocess output of arguments with braces in them on windows

2015-12-06 Thread Anthony Sottile
Anthony Sottile added the comment: To clarify further, the echo.exe on my path reacts correctly: ``` Anthony@AnthonysDesktop MINGW64 ~/Desktop/git/pre-commit (allow_curly_braces_in_args) $ /usr/bin/echo hi{1} hi{1} Anthony@AnthonysDesktop MINGW64 ~/Desktop/git/pre-commit

[issue25815] Improper subprocess output of arguments with braces in them on windows

2015-12-06 Thread Anthony Sottile
Anthony Sottile added the comment: ``` C:\Users\Anthony> C:\Users\Anthony\AppData\Local\Programs\Git\usr\bin\echo.exe hi{1} hi1 ``` Must be the provider of echo.exe. I'll take it up with them Sorry for the trouble! -- resolution: -> not a bug status: ope

[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Anthony Sottile
New submission from Anthony Sottile: I've confirmed this bug is present on both windows and linux, the outputs below are from linux however. Compare: ``` $ python3.4 --version Python 3.4.3 $ python3.4 -c 'import os; print(os.unlink == os.remove)' True ``` ``` $ python3.5 -

[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Anthony Sottile
Anthony Sottile added the comment: Breaks this function: ``` def rmtree(path): """On windows, rmtree fails for readonly dirs.""" def handle_remove_readonly(func, path, exc): # pragma: no cover (windows) excvalue = exc[1] if fun

[issue25930] os.unlink != os.remove in python3.5

2015-12-22 Thread Anthony Sottile
Anthony Sottile added the comment: When calling shutil.rmtree on windows on a readonly directory, the error handler is called with os.unlink as the first argument `func` which fails the check `func in (os.rmdir, os.remove)` which succeeded on previous python versions

[issue8557] subprocess PATH semantics and portability

2016-03-24 Thread Anthony Sottile
Anthony Sottile added the comment: Here's the workaround I'm opting for: if sys.platform =='win32': distutils.spawn.find_executable(cmd[0]) + cmd[1:] -- nosy: +Anthony Sottile ___ Python tracker <http://bu

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
New submission from Anthony Sottile: Originally from https://github.com/testing-cabal/mock/issues/350 ## Example ```python from unittest import mock class C(object): def f(self): pass c = C() with mock.patch.object(c, 'f', autospec=True): with mock.patch.ob

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
Anthony Sottile added the comment: The root cause seems to be that autospecced functions return a function object (not a Mock instance) which a '.mock' attribute which is a MagicMock ( assigned here: https://github.com/python/cpython/blob/ae775ab1eb72f42de2d070158bade4bf261ac04f/Li

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-04-06 Thread Anthony Sottile
Anthony Sottile added the comment: Here's an improved patch which: - passes the tests - puts the test in the correct place I'm not entirely happy with the approach -- open to suggestions :) -- Added file: http://bugs.python.org/file42

[issue26717] wsgiref.simple_server: mojibake with cp1252 bytes in PATH_INFO

2016-04-08 Thread Anthony Sottile
New submission from Anthony Sottile: Patch attached with test. In summary: A request to the url b'/\x80' appears to the application as a request to b'\xc2\x80' -- The issue being the latin1 decoded PATH_INFO is re-encoded as UTF-8 and then decoded as latin1 (on the wi

[issue26717] wsgiref.simple_server: mojibake with cp1252 bytes in PATH_INFO

2016-04-08 Thread Anthony Sottile
Anthony Sottile added the comment: A few typos in my previous comment, pressed enter too quickly, here's an updated comment: Patch attached with test. In summary: A request to the url b'/\x80' appears to the application as a request to b'/\xc2\x80' -- The issue

[issue26717] wsgiref.simple_server: mojibake with cp1252 bytes in PATH_INFO

2016-04-08 Thread Anthony Sottile
Anthony Sottile added the comment: Oops, broke b'/%80'. Here's a better fix that now takes: (on the wire) b'\x80' -(decode latin1)-> u'\x80' -(encode utf-8)-> b'\xc2\x80' -(decode latin1)-> u'\xc2\x80' to: (on the wire

[issue26717] wsgiref.simple_server: mojibake with cp1252 bytes in PATH_INFO

2016-04-08 Thread Anthony Sottile
Anthony Sottile added the comment: Updates after review. -- Added file: http://bugs.python.org/file42404/patch ___ Python tracker <http://bugs.python.org/issue26

[issue26717] wsgiref.simple_server: mojibake with cp1252 bytes in PATH_INFO

2016-04-08 Thread Anthony Sottile
Anthony Sottile added the comment: Forgot to remove the pyver code (leaning a bit too much on pre-commit) -- Added file: http://bugs.python.org/file42405/patch ___ Python tracker <http://bugs.python.org/issue26

[issue26717] wsgiref.simple_server: mojibake with cp1252 bytes in PATH_INFO

2016-04-20 Thread Anthony Sottile
Anthony Sottile added the comment: PEP states that environ variables are str variables decoded using latin1: https://www.python.org/dev/peps/pep-/#id19 Therefore, to get the original bytes, one must encode using latin1 On Apr 20, 2016 3:46 AM, "Александр Эри" wrote: > &g

[issue16662] load_tests not invoked in package/__init__.py

2016-04-25 Thread Anthony Sottile
Anthony Sottile added the comment: I have a hunch that this fix here may be causing this: https://github.com/spotify/dh-virtualenv/issues/148 Minimally: echo 'from setuptools import setup; setup(name="demo")' > setup.py echo 'import pytest' > tests/__init_

[issue26704] unittest.mock.patch: Double patching instance method: AttributeError: Mock object has no attribute '__name__'

2016-05-01 Thread Anthony Sottile
Anthony Sottile added the comment: Seems I've named the patchfile incorrectly -- Hopefully this is correct this time? -- keywords: +patch nosy: +Anthony Sottile Added file: http://bugs.python.org/file42675/2.patch ___ Python tracker

[issue24085] large memory overhead when pyc is recompiled

2015-04-30 Thread Anthony Sottile
Anthony Sottile added the comment: Adding `import gc; gc.collect()` doesn't change the outcome afaict -- nosy: +asottile ___ Python tracker <http://bugs.python.org/is

[issue24085] large memory overhead when pyc is recompiled

2015-05-01 Thread Anthony Sottile
Anthony Sottile added the comment: I'm still seeing a very large difference: asottile@work:/tmp$ python repro.py ready 72604 VmHWM: 72604 kB VmRSS: 60900 kB asottile@work:/tmp$ rm *.pyc; python repro.py ready 1077232 VmHWM: 1077232 kB VmRSS:218040 kB This fi

[issue24085] large memory overhead when pyc is recompiled

2015-05-01 Thread Anthony Sottile
Anthony Sottile added the comment: 3.4 seems happier: asottile@work:/tmp$ rm *.pyc; python3.4 repro.py ready 77472 VmHWM: 77472 kB VmRSS: 65228 kB asottile@work:/tmp$ python3.4 repro.py ready 77472 VmHWM: 77472 kB VmRSS: 65232 kB The nasty result above is from 2.7: $ python

<    1   2   3   4   5   >