[issue35224] PEP 572: Assignment Expressions
Emily Morehouse added the comment: All areas that were identified for additional work have been addressed. If there is anything else that needs to be improved or updated, please create a new issue. Thanks! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
Change by Emily Morehouse : -- pull_requests: +15572 pull_request: https://github.com/python/cpython/pull/15935 ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36798] f-strings do not support top-level :=
Emily Morehouse added the comment: Ah yes, that's what I meant. I was thinking about the confusion between f-strings (evaluated immediately and stored as a string) vs other versions of string formatting which are evaluated when used. I've seen the mix of the two confuse people when evaluating performance. I don't think this is particularly relevant to this issue though, so we can ignore it :) -- ___ Python tracker <https://bugs.python.org/issue36798> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36798] f-strings do not support top-level :=
Emily Morehouse added the comment: My initial reaction is that named expressions should not be valid in f-strings and should instead raise an exception, the same way that using `a := 10` does. >>> a := 10 File "", line 1 a := 10 ^ SyntaxError: invalid syntax It could be expected that named expressions could be used in f-strings in the same way as, say, list comprehensions or when used in parenthesis. One of the tricky things about named expressions is that the scope of the variable being assigned to gets "elevated" to the enclosing scope (this is a slightly simplified explanation but applies for most cases). Since f-strings are executed when defined and not where they are used, this could lead to confusing behavior. Is it available only when defined? Would users expect a variable to be available again when the f-string if it were saved to a variable? Would we modify the expected behavior of named expressions to contain scope to only the f-string? I'm not sure that any of these are particularly clear in behavior or in the definitions laid out in PEP 572. -- ___ Python tracker <https://bugs.python.org/issue36798> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
Emily Morehouse added the comment: Ned is correct! I will be sprinting on docs for this at PyCon. -- ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36052] Assignment operator allows to assign to __debug__
Emily Morehouse added the comment: You should look in Python/ast.c. The naming convention follows some form of "named expression" (e.g. NamedExpr, ast_for_namedexpr). I'll have more time to look later this week, but let me know if you have any questions. -- ___ Python tracker <https://bugs.python.org/issue36052> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
Emily Morehouse added the comment: I have a work-in-progress (WIP) documentation branch I've been working on that I'll push up this week to address the following: - Add summary to What's New in Doc/whatsnew/3.8.rst - Add to list of delimiters in Doc/reference/lexical_analysis.rst - Add usage documentation in Doc/reference/expressions.rst - Update FAQ in Doc/faq/design.rst (https://bugs.python.org/issue35666) If anyone has another area they think the documentation should be updated, please let me know! -- ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
Emily Morehouse added the comment: @rhettinger absolutely, I'm going to include that in my documentation PR which is currently in progress. :) -- ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35877] parenthesis is mandatory for named expressions in while statement
Change by Emily Morehouse : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35877] parenthesis is mandatory for named expressions in while statement
Emily Morehouse added the comment: New changeset ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24 by Emily Morehouse in branch 'master': bpo-35877: Add test for while loop named expression without parentheses (GH-11726) https://github.com/python/cpython/commit/ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24 -- ___ Python tracker <https://bugs.python.org/issue35877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35861] test_named_expressions raises SyntaxWarning
Change by Emily Morehouse : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35861> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35877] parenthesis is mandatory for named expressions in while statement
Emily Morehouse added the comment: Thanks, Karthikeyan! I added an additional test to make sure this gets coverage. I'll close out this issue once tests pass and I can merge that. -- ___ Python tracker <https://bugs.python.org/issue35877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35877] parenthesis is mandatory for named expressions in while statement
Change by Emily Morehouse : -- pull_requests: +11608, 11609, 11610 ___ Python tracker <https://bugs.python.org/issue35877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35877] parenthesis is mandatory for named expressions in while statement
Change by Emily Morehouse : -- pull_requests: +11608 ___ Python tracker <https://bugs.python.org/issue35877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35877] parenthesis is mandatory for named expressions in while statement
Change by Emily Morehouse : -- pull_requests: +11608, 11609 ___ Python tracker <https://bugs.python.org/issue35877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35877] parenthesis is mandatory for named expressions in while statement
Emily Morehouse added the comment: New changeset d4fceaafb8e3f8700d9ec6ab37a51e903392f74f by Emily Morehouse (Xtreak) in branch 'master': bpo-35877: Make parenthesis optional for named expression in while statement (GH-11724) https://github.com/python/cpython/commit/d4fceaafb8e3f8700d9ec6ab37a51e903392f74f -- ___ Python tracker <https://bugs.python.org/issue35877> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35861] test_named_expressions raises SyntaxWarning
Emily Morehouse added the comment: New changeset 075de6cf6cb0f5f4d3711fc07f023a9a7a0a816b by Emily Morehouse (Joannah Nanjekye) in branch 'master': bpo-35861: Fix SyntaxWarning in test_named_expressions.py (GH-11722) https://github.com/python/cpython/commit/075de6cf6cb0f5f4d3711fc07f023a9a7a0a816b -- ___ Python tracker <https://bugs.python.org/issue35861> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35861] test_named_expressions raises SyntaxWarning
Emily Morehouse added the comment: Yes, you're exactly correct! Feel free to submit a PR and add me as a reviewer when you're ready. -- assignee: -> xtreak stage: -> needs patch ___ Python tracker <https://bugs.python.org/issue35861> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
Emily Morehouse added the comment: @vstinner Is there something I could/should have checked other than the CI displayed in GitHub before merging? Let me know if I can help. Here's a brief summary of the differences between the PEP spec and implementation: >From the "Scope of the target" section of the PEP, there are two cases that >should raise a TargetScopeError: when an assignment expression is used in a >comprehension inside a class body or for special cases in comprehensions. Invalid examples for the latter include: [i := i+1 for i in range(5)] [[(j := j) for i in range(5)] for j in range(5)] [i := 0 for i, j in stuff] [i+1 for i in i := stuff] However, the following work in the implementation,though the PEP states they should be invalid: >>> [i := i+1 for i in range(5)] [1, 2, 3, 4, 5] >>> i 5 >>> [i := 0 for i, j in [(1, 2)]] [0] The following does not work in the implementation (as desired), but does not throw a TargetScopeError as defined in the PEP: >>> [i+1 for i in i := range(5)] File "", line 1 [i+1 for i in i := range(5)] ^ SyntaxError: invalid syntax IMO, I was leaning towards advocating for changing the PEP to match the implementation. I think the error messages are clear and expected, and restricting what already works would require significant special cases. I'm open to discussion though. There's also documentation that should certainly be added (and I believe a spot where assignment expressions are explicitly mentioned as not being included in the language, which is no longer the case) -- ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
Emily Morehouse added the comment: New changeset 8f59ee01be3d83d5513a9a3f654a237d77d80d9a by Emily Morehouse in branch 'master': bpo-35224: PEP 572 Implementation (#10497) https://github.com/python/cpython/commit/8f59ee01be3d83d5513a9a3f654a237d77d80d9a -- ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33416] Add endline and endcolumn to every AST node
Change by Emily Morehouse : -- pull_requests: +11441 ___ Python tracker <https://bugs.python.org/issue33416> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30455] Generate all tokens related code and docs from Grammar/Tokens
Change by Emily Morehouse : -- pull_requests: +9865 ___ Python tracker <https://bugs.python.org/issue30455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
Change by Emily Morehouse : -- keywords: +patch pull_requests: +9758 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
Change by Emily Morehouse : -- keywords: +patch, patch pull_requests: +9758, 9759 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35224] PEP 572: Assignment Expressions
New submission from Emily Morehouse : This issue will serve to track development and PRs for the implementation of PEP 572: Assignment Expressions. -- assignee: emilyemorehouse components: Interpreter Core messages: 329781 nosy: emilyemorehouse, gvanrossum, tim.peters priority: normal severity: normal status: open title: PEP 572: Assignment Expressions type: enhancement versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33878] Doc: Assignment statement to tuple or list: case missing.
Change by Emily Morehouse : -- nosy: +emilyemorehouse ___ Python tracker <https://bugs.python.org/issue33878> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30455] Generate C code from token.py and not vice versa
Change by Emily Morehouse : -- pull_requests: +8783 ___ Python tracker <https://bugs.python.org/issue30455> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34450] improve shutil.make_archive
Emily Morehouse added the comment: I'll have to think through this a bit more, but my gut is that it would be much more favorable for backwards-compatibility to clarify the documentation instead of changing the functionality. In any case, the change would only take effect in 3.8+, so it sounds like a backported documentation update is surely needed. Thanks for the thorough report! :) -- components: +Library (Lib) nosy: +emilyemorehouse type: -> behavior versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue34450> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34237] faq/design: PEP 572 adds assignment expressions
Emily Morehouse added the comment: This issue was brought to my attention -- I'm helping build the PEP 572 implementation. I'll make sure the docs get updated (and Jonathan, I didn't actually know that assignment expressions were mentioned in the FAQ, so this was still helpful!) -- assignee: docs@python -> emilyemorehouse nosy: +emilyemorehouse ___ Python tracker <https://bugs.python.org/issue34237> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33968] os.makedirs and empty string
Change by Emily Morehouse : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue33968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33968] os.makedirs and empty string
Emily Morehouse added the comment: The os.path conventions do follow, '' and '.' are not treated the same here either -- >>> os.path.exists('') False >>> os.path.exists('.') True >>> os.path.isdir('') False >>> os.path.isdir('.') True The only os.path function that I see as potentially confusing in this discussion is dirname, as that can return an empty string which yields unexpected results when used as an argument for other functions. >>> os.path.dirname('testdir') '' >>> os.path.dirname('./testdir') '.' However, changing this functionality (e.g. os.path.dirname('testdir') returning '.') would result in backward-compatibility issues that would not be warranted (IMO). I'll leave the final word to Serhiy to close out as 'not a bug' at his discretion. -- assignee: -> emilyemorehouse nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue33968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33968] os.makedirs and empty string
Emily Morehouse added the comment: I'll defer to Serhiy's os.path expertise, but from what I know -- os.dirname is essentially a helper function for returning the first item of split. What I'm gathering is that you're looking for a more advanced way of parsing a file path -- say "nested/dir/sample.txt" -- to "nested/dir" while also handling parsing "" into ".". Not the prettiest, but you could wrap os.path.dirname in os.path.normpath: >>> os.path.normpath(os.path.dirname("nested/dir/sample.txt")) 'nested/dir' >>> os.path.normpath(os.path.dirname("")) '.' -- ___ Python tracker <https://bugs.python.org/issue33968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33968] os.makedirs and empty string
Emily Morehouse added the comment: This is an interesting behavior to note. I think the current behavior makes the most sense, as it corresponds to the OS-level errors that you get from running the same operations. Interestingly, at least on Unix-based file systems, we get different error messages but the same behavior when using "" vs "." as our target: [linux]$ mkdir "" mkdir: cannot create directory ‘’: No such file or directory [linux]$ mkdir . mkdir: cannot create directory ‘.’: File exists [mac]$ mkdir "" mkdir: .: No such file or directory [mac]$ mkdir . mkdir: .: File exists Both os.mkdir and os.makedirs follow (only os.mkdir is included as the traceback is cleaner, but they raise the same errors): >>> os.mkdir("") Traceback (most recent call last): File "", line 1, in FileNotFoundError: [Errno 2] No such file or directory: '' >>> os.mkdir(".") Traceback (most recent call last): File "", line 1, in FileExistsError: [Errno 17] File exists: '.' Since on an OS level the only time "File exists" is returned is when using "." and not "", os.makedirs with exists_ok=True also follows: >>> os.makedirs("", exist_ok=True) Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/os.py", line 220, in makedirs mkdir(name, mode) FileNotFoundError: [Errno 2] No such file or directory: '' >>> os.makedirs(".", exist_ok=True) >>> Basically, the FileExistsError gets silenced, but FileNotFoundError is left alone. I can see how the differences are nuanced and not obvious though. Unless you think there is a succinct and worthwhile way of adding this to the documentation, I think this issue can be closed. -- nosy: +emilyemorehouse ___ Python tracker <https://bugs.python.org/issue33968> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33958] Unused variable in pur embedding example
Emily Morehouse added the comment: Thanks, Philip! If you're interested in submitting a PR, please do! If not, just comment back so someone else can pick it up. -- nosy: +emilyemorehouse stage: -> needs patch ___ Python tracker <https://bugs.python.org/issue33958> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32604] Expose the subinterpreters C-API in Python for testing use.
Change by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32604> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33392] pathlib .glob('*/') returns files as well as directories
Emily Morehouse <em...@cuttlesoft.com> added the comment: Good find -- I agree that when using Path.cwd().glob('*/'), it should only return directories. This follows the original glob library's functionality as well as the Unix expectation (I believe Windows as well, but I'll double check). I'll work on a fix! -- assignee: -> emilyemorehouse nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33392> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32689] shutil.move raises AttributeError if first argument is a pathlib.Path object and destination is a directory
Emily Morehouse <em...@cuttlesoft.com> added the comment: Ah, you're right. That was a typo when I was redacting my full path. The path object remains unchanged even though the directory has moved. Should have been: >>> import os, pathlib, shutil >>> os.mkdir('test1') >>> os.mkdir('test2') >>> path = pathlib.Path('test1') >>> path.absolute() PosixPath('/Users/e/Development/OSS/cpython/test1') >>> shutil.move(path, 'test2') 'test2/test1' >>> path.absolute() PosixPath('/Users/e/Development/OSS/cpython/test1') test1 is now actually at '/Users/e/Development/OSS/cpython/test2/test1' -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32689> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32689] shutil.move raises AttributeError if first argument is a pathlib.Path object and destination is a directory
Emily Morehouse <em...@cuttlesoft.com> added the comment: Thanks for the bug report! shutil.move should certainly accept a path object, as shutil.copy does, though it should be noted that in your example, 'path' could become out of date as it does not refresh the path information. For example, with shutil.move fixed: >>> import os, pathlib, shutil >>> os.mkdir('test1') >>> >>> os.mkdir('test2') >>> path = pathlib.Path('test1') >>> path.absolute() PosixPath('/Users/e/Development/OSS/cpython/test1') >>> shutil.move(path, 'test2') 'test2/test1' >>> path.absolute() PosixPath('/Users/e/Development/OSS/cpython/test2') test1 is now actually at '/Users/e/Development/OSS/cpython/test2/test1' For the fix: I did a bit of digging and the error comes from a helper method _basename that uses rstrip to remove a trailing separator, hence the error as rstrip doesn't exist for a path object (and I don't think it makes sense that it should, though that was one solution). Removing the trailing separator is, however, very important in determining the full destination path. After trying a few different approaches, I think the simplest way is to cast the src to a string before finding its appropriate basename. I also added some comments to make it more clear why _basename is used over os.path.basename to hopefully save someone else time in the future. A more robust option would be to explicitly handle Path objects or to handle exceptions for any dst that cannot be cast to a string. However, the current patch fixes the issue without introducing new problems. -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32689> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32689] shutil.move raises AttributeError if first argument is a pathlib.Path object and destination is a directory
Change by Emily Morehouse <em...@cuttlesoft.com>: -- keywords: +patch pull_requests: +5228 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32689> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32452] Brackets and Parentheses used in an ambiguous way
Change by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32452> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32452] Brackets and Parentheses used in an ambiguous way
Change by Emily Morehouse <em...@cuttlesoft.com>: -- keywords: +patch pull_requests: +4954 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32452> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26656] Documentation for re.compile is a bit outdated
Emily Morehouse added the comment: PR 3211 - LGTM, but is not CLA signed. Elena, a couple of notes on your patch. Using :ref:`regular expression object ` to link to the section of the documentation is preferred, as it does not rely on a consistent URL. Also, be mindful of line lengths, feel free to break lines to avoid this. If you would like to submit a PR on Github for these changes, it can more easily be merged in. (Check https://docs.python.org/devguide/pullrequest.html for more info). -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26656> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31152] Tutorial wording implies an understanding of a concept prior to it being introduced
Emily Morehouse added the comment: I concur with Raymond, particularly because paragraph 1 of section 8.5 links to the Classes tutorial which covers inheritance. I think the documentation is sufficient as is. -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31152> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30785] ast.c duplicates STR(CHILD)
Emily Morehouse added the comment: Thanks Christopher, you are absolutely correct. There are a few ways in which this code could be optimized (and many other small optimizations probably exist elsewhere in the code). If you are interested in submitting a PR for this, you are more than welcome to and I can re-open the issue. Otherwise, I'm going to close it out as this is not a critical optimization. -- nosy: +emilyemorehouse resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30785> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30769] [EASY (C)] test_execve_invalid_env() of test_os leaks references
Emily Morehouse added the comment: And thank you to Serhiy and Victor for the assistance and attention to this issue! -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30769] [EASY (C)] test_execve_invalid_env() of test_os leaks references
Emily Morehouse added the comment: Resolving this since the fix and backports have been merged in. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30769] [EASY (C)] test_execve_invalid_env() of test_os leaks references
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- pull_requests: +2503 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30769] [EASY (C)] test_execve_invalid_env() of test_os leaks references
Emily Morehouse added the comment: I think I need a bit more direction for the 3.5 backport. The original test below passes: ./python -m test -R 3:3 -m test_execve_invalid_env test_os -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30759] [2.7] Fix python2 -m test --list-cases test_multibytecodec_support test_robotparser
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30759> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30763] There is functionality bug in linecache library.
Emily Morehouse added the comment: This is the expected functionality of linecache. As each file is read, it is stored in a cache, subsequent calls using linecache do not check to see if the file has changed. If you know that the file has changed, you should call linecache.checkcache() to check all files or linecache.checkcache(filename) to check a specific file. (https://docs.python.org/2/library/linecache.html#linecache.checkcache) [Since no one is listed in the Experts Index, I've included some other contributors to linecache who can assist in closing out this issue] -- components: +Library (Lib) -2to3 (2.x to 3.x conversion tool) nosy: +emilyemorehouse, gvanrossum, rhettinger, serhiy.storchaka ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30763> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30769] [EASY (C)] test_execve_invalid_env() of test_os leaks references
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- pull_requests: +2477 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30773] async generator receives wrong value when shared between coroutines
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30773> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19479] textwrap.dedent doesn't work properly with strings containing CRLF
Emily Morehouse added the comment: @georg.brandl and @terry.reedy, this issue was mentioned again recently (http://bugs.python.org/issue30754). Would you like to revisit it? -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19479> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30754] textwrap.dedent mishandles empty lines
Emily Morehouse added the comment: I concur with Martin, whitespace is not expected to be preserved on whitespace-only lines nor even considered when finding common leading whitepace. To illustrate this, see the examples below: The following yields the same (expected) results: > python2 -c 'from textwrap import dedent; print repr(dedent(" " * 2 + "\n" + " " * 4 + "\t\n"))' > '\n\n' And a simplified version of a test case from test_textwrap.py: > python2 -c 'from textwrap import dedent; print repr(dedent(" Foo\n \n"))' > 'Foo\n\n' -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30754> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30769] [EASY (C)] test_execve_invalid_env() of test_os leaks references
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- stage: -> commit review ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30769] [EASY (C)] test_execve_invalid_env() of test_os leaks references
Emily Morehouse added the comment: I also found what Eric did, specifically lines 4913-4918 in the commit he mentioned introduced the bug: if (PyBytes_GET_SIZE(key2) == 0 || strchr(PyBytes_AS_STRING(key2) + 1, '=') != NULL) { PyErr_SetString(PyExc_ValueError, "illegal environment variable name"); goto error; } One of the tricks is that the test that fails was added after the commit that introduced the bug. -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30769> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30603] textwrap: declining indent level has no test case
Emily Morehouse added the comment: Looks great, thanks for the updates. Mariatta, can you get this merged in? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30603> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30628] why venv install old pip?
Emily Morehouse added the comment: A quick note on how to include system packages in the "How Do I..?" section could be helpful, though does not necessarily solve the current issue. I would be hesitant to instruct people to use the system-site-packages flag simply to have an updated version of setuptools, even with a strong word of caution. From my experience, most people generally don't have a clean pip environment outside of a virtual environment for various reasons and this could cause more confusion and undesired outcomes by encouraging use use of the system-site-packages flag. As a side note, I do feel that the existing documentation for the system-site-packages and without-pip flags is adequate as-is (that was one of the first things I tried when debugging this issue). Nick, could you answer a couple of questions for me? 1) I've read that (for Python 3.5 or greater) that venv is recommended over virtualenv. Why? (Not challenging anything, just trying to understand from the perspective of someone who has used virtualenv for years and never looked back). 2) Could there be an additional argument for venv that triggers an upgrade to setuptools on virtual environment creation? Alternatively, I've looked into extending venv.EnvBuilder. We could add an example of extending this to bootstrap environment building to include a setuptools upgrade on creation for those who deem this important. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30628> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30656] typo in PyModule_New documentation
Emily Morehouse added the comment: Good catch, fixed in PR. -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30656> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30656] typo in PyModule_New documentation
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- pull_requests: +2220 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30656> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30628] why venv install old pip?
Emily Morehouse added the comment: You're certainly right. venv uses ensurepip to install pip when creating a virtual environment and does not access the internet/upgrade any packages. ensurepip was specifically designed to use the bundled version of setuptools. The bundled version of setuptools was up to date as of the final Python 3.6.0 beta, though it seems like it could be due for an upgrade. For now, you can either run `pip install --upgrade setuptools` after activating your environment (recommended) or give your environment access to your local site packages that has the upgraded setuptools using `python3 -m venv foo --system-site-packages` (not recommended, as this will include ALL global packages you have installed). Alternatively, virtualenv (https://virtualenv.pypa.io/en/stable/) maintains an updated version of setuptools more frequently, though it must be installed as an additional package. It should also be noted that wheel is not installed by venv and must also be installed after the environment creation if needed. -- nosy: +ncoghlan ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30628> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30628] why venv install old pip?
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30628> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26656] Documentation for re.compile is a bit outdated
Emily Morehouse added the comment: YAHO (yet another humble opinion), I support improving the current re.compile documentation by adding a link to the regular expression object documentation. Great way to point a user to the complete list of methods and attributes while keeping match() and search() listed explicitly. -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26656> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30603] textwrap: declining indent level has no test case
Emily Morehouse added the comment: Good catch. We should also add additional tests for a declining indentation level with a blank line and a declining indentation with a whitespace only line, as it is a pattern followed throughout the dedent tests. It should be noted that PR 2014 is the appropriate pull request for this issue. PR 2064 is for a different, though related, issue (https://bugs.python.org/issue30620). -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30603> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30620] textwrap: dedent contains logic that can never execute
Emily Morehouse added the comment: Jonathan, could you improve the comments for the dedent function? You have a great understanding of the logic flow from your proof and it would be beneficial to document this to avoid future confusion. Specifically, it should be clear that Clause 2 inherently handles equivalence for margin and indent and that Clause 4 will always complete with the break statement. -- nosy: +serhiy.storchaka ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30620> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30620] textwrap: dedent contains logic that can never execute
Emily Morehouse added the comment: The logic in your proof is certainly sound. The only time that the else statement within Clause 4 (to use terminology from the proof) would execute is either 1) if margin is equal to indent, which is handled in Clause 2, or 2) if the margin is None, which is handled in Clause 1. I support this PR. On a related note, I feel that the existing comments could clearer illustrate this. Specifically, it is unclear that Clause 2 will also catch cases where margin and indent are equal. -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30620> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30501] Produce optimized code for boolean conditions
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30501> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30440] document peephole optimizer effects
Emily Morehouse added the comment: Raymond, I'm willing to take over this issue with your guidance if you're open to it. -- nosy: +emilyemorehouse, rhettinger ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30440> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30388] ndbm can't iterate through values on OS X
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30388> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26890] inspect.getsource gets source copy on disk even when module has not been reloaded
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26890> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue28121] If module starts with comment or empty line then frame.f_code.co_firstlineno is inconsistent with inspect.findsource
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28121> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError
Emily Morehouse added the comment: Serhiy, thank you for the update. I looked over your patch to ensure that I understood your solution. I also appreciate your tests, as I was able to see other edge cases that I perhaps would not have thought of. Yury, I'm more than happy to help! I've spent a decent amount of time learning about code objects, byte code, etc. and I'd love to put that knowledge to use. Let me know the best way to find these issues on the tracker or otherwise. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29354> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29339] Interactive: Move to same indentation level as previous line
Changes by Emily Morehouse <em...@cuttlesoft.com>: -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29339> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError
Emily Morehouse added the comment: Yury, thanks for the encouragement to continue on this patch. I think it will be a good exercise to dive a bit deeper into Python's bytecode and put some knowledge to use. I believe that tuple argument unpacking is handled appropriately, but there is an even further edge case where a closure is introduced. In the following, inspect.getargspec works for the first bit of code, but the second fails, as 'a' is referenced outside of scope. >>> dis.dis(lambda (a,): lambda x: x) 1 0 LOAD_FAST0 (.0) 3 UNPACK_SEQUENCE 1 6 STORE_FAST 1 (a) 9 LOAD_CONST 1 ( at 0x10087a130, file "", line 1>) 12 MAKE_FUNCTION0 15 RETURN_VALUE >>> dis.dis(lambda (a,): lambda x: a) 1 0 LOAD_FAST0 (.0) 3 UNPACK_SEQUENCE 1 6 STORE_DEREF 0 (a) 9 LOAD_CLOSURE 0 (a) 12 BUILD_TUPLE 1 15 LOAD_CONST 1 ( at 0x10087a930, file "", line 1>) 18 MAKE_CLOSURE 0 21 RETURN_VALUE I'll keep poking at this and see where I get. -- EM -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29354> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29341] Missing accepting path-like object in docstrings of os module functions
Emily Morehouse added the comment: I see that path-like objects are indeed mentioned in the documentation (Doc/library/os.rst), simply stating "Changed in version 3.6: Supports a path-like object." Other methods, such as os.chroot, also mention such a change. Comparing the docs mentioned above to the docstrings in Modules/clinic/posixmodule.c.h (and Modules/clinic/posixmodule.c for that matter), there's a clear disparity between the detail in the docs vs brevity in the docstrings (specifically in reference to os.chroot). Therefore, my question is: how detailed should the docstrings be and how closely should they match Doc/library/os.rst? I can certainly update the docstrings accordingly. -- nosy: +emilyemorehouse ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29341> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError
Emily Morehouse added the comment: Aspiring contributor here! I believe I have narrowed this error down to the inspect module, specifically in the for loop beginning on line 759. There's a bit of "acrobatics" (to quote the code comments) that I'm trying to sift through, I've been using the getargspec method from the inspect module as well as print statements in the inspect module to narrow down the error. It definitely doesn't seem like the previously mentioned for loop is functioning properly, as the first item in the stack is being referenced when it is empty. Additionally, I'm utilizing the dis module to help make sense of the full code object to compare against the behavior in the for loop. Yury, I've respectfully included you here as you're listed as the expert for the inspect module. I would really like to submit a patch for this, but may need a nudge in the right direction. I will update here with my progress. -- nosy: +emilyemorehouse, yselivanov ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29354> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26829] update docs: when creating classes a new dict is created for the final class object
Emily Morehouse added the comment: Trimmed down by keeping the more explicit explanation and taking into account suggestions. -- Added file: http://bugs.python.org/file43127/26829-v3.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26829> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26829] update docs: when creating classes a new dict is created for the final class object
Emily Morehouse added the comment: Second version of patch for this -- more clearly states the process and outcome for class creation. Also adds to https://docs.python.org/3.6/library/functions.html#type to clarify that the dictionary object is copied to a standard dict. -- Added file: http://bugs.python.org/file43122/26829-v2.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26829> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26829] update docs: when creating classes a new dict is created for the final class object
Emily Morehouse added the comment: Super straight-forward -- this simply adds to the docs on creating the class object that the values used in creation are copied to the final object (including the namespace). -- keywords: +patch nosy: +emilyemorehouse Added file: http://bugs.python.org/file43112/26829.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26829> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13784] Documentation of xml.sax.xmlreader: Locator.getLineNumber() and Locator.getColumnNumber()
Emily Morehouse added the comment: The reported behavior has been verified -- the documented behavior is indeed incorrect for both Locator.getColumnNumber() and Locator.getLineNumber(). The beginning line and column numbers are returned, not the end. This has been tested and verified for Python 2.7, Python 3.5.1 and a local build of the current default branch. -- keywords: +patch nosy: +emilyemorehouse versions: +Python 2.7, Python 3.2, Python 3.3, Python 3.6 Added file: http://bugs.python.org/file43109/13784.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13784> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com