[issue2134] Add new attribute to TokenInfo to report specific token IDs

2011-12-14 Thread Nick Coghlan
Nick Coghlan added the comment: Sure, but what does that have to do with anything? tokenize isn't a general purpose tokenizer, it's specifically for tokenizing Python source code. The *problem* is that it doesn't currently fully tokenize everything, but doesn't explic

[issue2134] Add new attribute to TokenInfo to report specific token IDs

2011-12-14 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, I didn't read it as suggested documentation at all - you moved seamlessly from personal commentary to a docs suggestion without separating the two, so it appeared to be a complete non sequitur to me. As for the docs suggestion, I think it works a

[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Nick Coghlan
Nick Coghlan added the comment: The keyword-only idea is a backwards compatibility hack we discussed at the PyCon US sprints because ImportError currently accepts an arbitrary number of arguments: >>> raise ImportError(1, 2, 3) Traceback (most recent call last): File "

[issue11647] function decorated with a context manager can only be invoked once

2011-12-17 Thread Nick Coghlan
Nick Coghlan added the comment: I'm prototyping a public version of the recreation API as "ContextDecorator.refresh_cm()" in contextlib2: http://contextlib2.readthedocs.org/en/latest/index.html#contextlib2.ContextDecorator.refresh_cm -- type: behavior

[issue2134] Add new attribute to TokenInfo to report specific token IDs

2011-12-18 Thread Nick Coghlan
Nick Coghlan added the comment: Meador's patch looks good to me. The docs change for 2.7 and 3.2 would be similar, just with text like "Specific tokens can be distinguished by checking the ``string`` attribute of OP tokens for a match with the expected character sequence."

[issue13607] Move generator specific sections out of ceval.

2011-12-20 Thread Nick Coghlan
Nick Coghlan added the comment: The thing that most appeals to me with this concept is moving closer to making it possible to experiment with generator-style functionality in *extension* modules (albeit extension modules that are coupled to private CPython APIs). So, for me, "not worse

[issue13646] Document poor interaction between multiprocessing and -m on Windows

2011-12-21 Thread Nick Coghlan
New submission from Nick Coghlan : The http://docs.python.org/library/multiprocessing#windows section of the docs should document the limitations that multiprocessing on Windows places on __main__ module invocation. - no execution of modules inside packages with -m - no execution of packages

[issue10128] multiprocessing.Pool throws exception with __main__.py

2011-12-21 Thread Nick Coghlan
Nick Coghlan added the comment: The fix from #10845 should be backported to Python 2.7 (bypassing the assertion isn't enough - you want to skip re-executing __main__ entirely) -- nosy: +ncoghlan ___ Python tracker <http://bugs.py

[issue13646] Document poor interaction between multiprocessing and -m on Windows

2011-12-21 Thread Nick Coghlan
Nick Coghlan added the comment: (Actually the latter isn't true - the __main__ bypass handles that case. Since none of the code gets executed in the child process, it doesn't generally matter that __package__ isn't set properly) -- ___

[issue13585] Add contextlib.CleanupManager

2011-12-21 Thread Nick Coghlan
Nick Coghlan added the comment: My earlier descriptions here aren't really adequate - as soon as I started putting contextlib2 together, this CleanupManager idea quickly morphed into ContextStack [1], which is a far more powerful tool for manipulating context managers in a way that do

[issue13585] Add contextlib.ContextStack

2011-12-21 Thread Nick Coghlan
Nick Coghlan added the comment: Updated issue title to reflect what I'll eventually be proposing (once the ContextStack API has had a chance to mature on PyPI as part of contextlib2) -- title: Add contextlib.CleanupManager -> Add contextlib.Cont

[issue13585] Add contextlib.ContextStack

2011-12-21 Thread Nick Coghlan
Nick Coghlan added the comment: Yeah, adding a "Recipes" section for contextlib2 is definitely on my to-do list (along with adding more examples in general). -- ___ Python tracker <http://bugs.python.o

[issue13585] Add contextlib.ContextStack

2011-12-22 Thread Nick Coghlan
Nick Coghlan added the comment: ContextStack is intended to be a building block that makes it easy to compose context managers and other callbacks, not necessarily an API you'd regularly use directly. For example, given ContextStack (as currently implemented in contextlib2), it's

[issue13585] Add contextlib.ContextStack

2011-12-22 Thread Nick Coghlan
Nick Coghlan added the comment: The comparison to Go's defer statement is interesting, though: ContextStack.register basically *is* the same as defer. While a nested with statement is a better option in Python, if we ignore that for the moment, you *could* write that simply copying ex

[issue9922] subprocess.getstatusoutput can fail with utf8 UnicodeDecodeError

2011-12-22 Thread Nick Coghlan
Nick Coghlan added the comment: It is indeed unfortunate that these two functions weren't killed off in the Py3k transition instead of being migrated from the commands module to subprocess (their current implementation runs counter to the entire subprocess security design by impli

[issue13033] Add shutil.chowntree

2012-01-07 Thread Nick Coghlan
Nick Coghlan added the comment: I believe the current "check_chown" could be passed by a no-op (since the file will be owned by the current user even *before* the call to chowntree). Testing this properly is actually rather difficult (since the only uid and gid we can rely on ar

[issue13734] Add a generic directory walker method to avoid symlink attacks

2012-01-07 Thread Nick Coghlan
Nick Coghlan added the comment: I'm working on a library of general directory walking tools that will hopefully make their way back into the stdlib at some point (http://walkdir.readthedocs.org). They're designed to filter and transform the output of os.walk (and similar ite

[issue13734] Add a generic directory walker method to avoid symlink attacks

2012-01-08 Thread Nick Coghlan
Nick Coghlan added the comment: Since walkdir is currently entirely based on returning filesystem paths as strings (just like os.walk()) and hence shares the pervasive symlink attack vulnerability, I'm particularly interested in the question of whether or not the various *at APIs can be

[issue13734] Add a generic directory walker method to avoid symlink attacks

2012-01-08 Thread Nick Coghlan
Nick Coghlan added the comment: Another, possibly better, alternative would be to produce a tuple-subclass that adds a separate "dirfd" attribute to the (dirpath, subdirs, files) triple. I'll stop talking about the walkdir implications here. Instead, I've created a co

[issue13734] Add a generic directory walker method to avoid symlink attacks

2012-01-08 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks for that Charles-François - do you mind if I adapt that for walkdir? The changes I would make are basically those that Antoine pointed out: - rather than replacing the dirpath entry, instead yield a 4-tuple that appends the dirfd attribute at the end

[issue13734] Add a generic directory walker method to avoid symlink attacks

2012-01-09 Thread Nick Coghlan
Nick Coghlan added the comment: OK, os.walkfd is sounding good: - accepts a file descriptor, byte sequence or string for "top" - produces 4-tuples, with the dirfd added at the end - documents clearly that the dirfd is normally only valid until the next iteration step, so you ne

[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan
Changes by Nick Coghlan : Added file: http://bugs.python.org/file24213/494c976c41c4.diff ___ Python tracker <http://bugs.python.org/issue11682> ___ ___ Python-bugs-list m

[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan
Changes by Nick Coghlan : Removed file: http://bugs.python.org/file23774/0d1d76f68750.diff ___ Python tracker <http://bugs.python.org/issue11682> ___ ___ Python-bug

[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan
Changes by Nick Coghlan : Removed file: http://bugs.python.org/file24213/494c976c41c4.diff ___ Python tracker <http://bugs.python.org/issue11682> ___ ___ Python-bug

[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan
Changes by Nick Coghlan : Added file: http://bugs.python.org/file24214/f8349cbc1b26.diff ___ Python tracker <http://bugs.python.org/issue11682> ___ ___ Python-bugs-list m

[issue11682] PEP 380 reference implementation for 3.3

2012-01-12 Thread Nick Coghlan
Nick Coghlan added the comment: Nice milestone this evening: by incorporating doc updates based on Zbysek's efforts and dropping the explicit bytecode generation tests, I now have something that appears ready to commit *without* a dependency on the proposed dis module updates. So, ass

[issue5405] There is no way of determining which ABCs a class is registered against

2011-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: This topic came up again on python-ideas: http://mail.python.org/pipermail/python-ideas/2011-May/010293.html -- stage: -> needs patch ___ Python tracker <http://bugs.python.org/iss

[issue12106] reflect syntatic sugar in with ast

2011-05-24 Thread Nick Coghlan
Nick Coghlan added the comment: Just to articulate the rationale, I'm guessing the reasoning behind this is to make it feasible for source->AST->source translators to retain the original grouping? -- ___ Python tracker <http://b

[issue12106] reflect syntatic sugar in with ast

2011-05-24 Thread Nick Coghlan
Nick Coghlan added the comment: Visual scan of the patch in Reitveld looks fine to me. -- ___ Python tracker <http://bugs.python.org/issue12106> ___ ___ Pytho

[issue12182] pydoc.py integer division problem

2011-05-25 Thread Nick Coghlan
Changes by Nick Coghlan : -- assignee: -> ncoghlan nosy: +ncoghlan ___ Python tracker <http://bugs.python.org/issue12182> ___ ___ Python-bugs-list mai

[issue12174] Multiprocessing logging levels unclear

2011-05-25 Thread Nick Coghlan
Changes by Nick Coghlan : -- nosy: +jnoller, ncoghlan ___ Python tracker <http://bugs.python.org/issue12174> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12191] Shutil - add chown() in order to allow to use user and group name (and not only uid/gid)

2011-05-26 Thread Nick Coghlan
Changes by Nick Coghlan : -- nosy: +ncoghlan ___ Python tracker <http://bugs.python.org/issue12191> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12194] Fix LDFLAGS on Ubuntu 11.04+

2011-05-26 Thread Nick Coghlan
New submission from Nick Coghlan : A complete build on Ubuntu currently requires fiddling with LDFLAGS before invoking configure (otherwise the build process fails to find the necessary pieces to build some modules): http://www.technobits.net/articles/8919/christian-heimes-how-to-compile

[issue1189811] pydoc may hide non-private doc strings.

2011-05-27 Thread Nick Coghlan
Nick Coghlan added the comment: In the time since 2.3, pydoc.visiblename() has been updated to use the correct definition of visibility. A "developer" mode that exposes internal details doesn't make sense. When you're developing something and want to see internal details

[issue12199] Unify TryExcept and TryFinally

2011-05-28 Thread Nick Coghlan
Nick Coghlan added the comment: >From my review: """One genuine problem with a stale assert and comment in ast.c, and a small objection to style in compile.c (I'd like a new compile_try() function to match the new AST node). Otherwise looke

[issue12106] reflect syntatic sugar in with ast

2011-05-28 Thread Nick Coghlan
Nick Coghlan added the comment: The AST version changed, and, more importantly, if other implementations pick up our AST changes without updating their compilers accordingly, their symbol table analysis and code compilation processes will break. So yes, the test suite does already cover this

[issue12106] reflect syntatic sugar in with ast

2011-05-28 Thread Nick Coghlan
Nick Coghlan added the comment: One other thing I should mention is that in a later checkin, Benjamin did add a couple of explicit with statement examples to test_ast. These will fail if other implementations don't update the front end of their compilation processes correctly, so that s

[issue12199] Unify TryExcept and TryFinally

2011-05-29 Thread Nick Coghlan
Nick Coghlan added the comment: Looks good to me. -- ___ Python tracker <http://bugs.python.org/issue12199> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11505] string.py increased test coverage

2011-05-31 Thread Nick Coghlan
Nick Coghlan added the comment: Some comments on the follow-up changes I just committed: - It's an illustration of the fact that coverage data is only step 1 in improving tests. - I added additional assertions regarding the error message contents to a couple of tests, and also verified

[issue11505] string.py increased test coverage

2011-05-31 Thread Nick Coghlan
Changes by Nick Coghlan : -- resolution: -> fixed stage: commit review -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.or

[issue11822] Improve disassembly to show embedded code objects

2011-05-31 Thread Nick Coghlan
Nick Coghlan added the comment: Note that Yaniv Aknin (author of the Python's Innards series of blog posts) has a recursive dis variant that may be useful for inspiration: https://bitbucket.org/yaniv_aknin/pynards/src/c4b61c7a1798/common/blog.py As shown there, this recursive behaviou

[issue12248] __dir__ semantics changed in Python 2.7.2

2011-06-02 Thread Nick Coghlan
Nick Coghlan added the comment: Hmm, that behaviour looks unrelated to the specific problem Michael reported. The initial problem in this space was that defining __dir__() completely determined the result of dir() calls, but object.__dir__() didn't actually work, so you couldn't

[issue12248] __dir__ semantics changed in Python 2.7.2

2011-06-03 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, I wondered about that when I saw Barry was using old-style classes in his example. Perhaps the answer then is to add a PyInstance_Check() to skip invocation of __dir__() completely for old-style classes

[issue12248] __dir__ semantics changed in Python 2.7.2

2011-06-03 Thread Nick Coghlan
Nick Coghlan added the comment: It would be broken in the same way that it was broken in 2.7.1 though. That can be a plus when it comes to maintenance releases. OTOH, this does turn a silent failure (__dir__() ignored on old-style classes) into a noisy failure (must return a list). If you

[issue12265] revamp argument errors

2011-06-04 Thread Nick Coghlan
Nick Coghlan added the comment: Looks good in a desk review. Assuming the full test suite passes, +1 from me. -- nosy: +ncoghlan ___ Python tracker <http://bugs.python.org/issue12

[issue11690] Devguide: Add "communication" FAQ

2011-06-06 Thread Nick Coghlan
Nick Coghlan added the comment: On a related note, http://docs.python.org/devguide/docquality.html should mention that the devguide itself lives in a different repo but the process is otherwise similar to contributing to the main docs

[issue11549] Rewrite peephole to work on AST

2011-06-06 Thread Nick Coghlan
Nick Coghlan added the comment: Eugene raised the question of AST changes on python-dev [1] and the verdict was that so long as ast.__version__ is updated, AST clients will be able to cope with changes. Benjamin Peterson made some subsequent changes to the AST (bringing the AST for try and

[issue12273] Change ast.__version__ calculation to provide consistent ordering

2011-06-06 Thread Nick Coghlan
New submission from Nick Coghlan : Benjamin's AST modification checkins switched directly from the SVN revision number (as a string) to the hg revision hash. While that preserves uniqueness, it makes ordering difficult to determine. The last AST version in 3.2 was '82163' (an

[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2011-06-08 Thread Nick Coghlan
Nick Coghlan added the comment: As Raymond noted though, some of the block stack fiddling doesn't make sense until after the bytecode has already been generated. It's OK to have multiple optimisers at different layers, each taking care of the elements that are best suited to that l

[issue1294232] Error in metaclass search order

2011-06-10 Thread Nick Coghlan
Changes by Nick Coghlan : -- assignee: -> ncoghlan ___ Python tracker <http://bugs.python.org/issue1294232> ___ ___ Python-bugs-list mailing list Unsubscri

[issue11553] Docs for: import, packages, site.py, .pth files

2011-06-11 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks for getting started with such a detailed review on this Graham. We've known the documentation in this area has been flawed for a long time, but actually *fixing* seemed like such a big task that it has tended to get pushed to the bottom o

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Nick Coghlan
Nick Coghlan added the comment: inspect.getattr_static has the necessary logic to search for descriptors without invoking them. However, it may be better to revert to the idea of pushing this functionality back onto the individual descriptors and have the problematic descriptors like

[issue11553] Docs for: import, packages, site.py, .pth files

2011-06-11 Thread Nick Coghlan
Nick Coghlan added the comment: "Public name" is a term that describes a convention, not anything enforced by the interpreter. Names starting with underscores typically aren't public either (unless documented otherwise), but that has no effect on the ability to retrieve them a

[issue11610] Improved support for abstract base classes with descriptors

2011-06-11 Thread Nick Coghlan
Nick Coghlan added the comment: Remember the goal here is *not* to completely eliminate the need to test that objects implement an ABC correctly. It's to make it easier to declare the expected interface in a way that helps readers of the ABC definition to figure out what is going on, a

[issue11553] Docs for: import, packages, site.py, .pth files

2011-06-12 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, now I get your point re .pkg vs .pth. I naturally read that as ".pth entries are to sys.path entries as .pkg entries are to pkg.__path__ entries", without any hint that those are the same *kind* of thing. However, I already know that sys.pa

[issue11610] Improved support for abstract base classes with descriptors

2011-06-12 Thread Nick Coghlan
Nick Coghlan added the comment: In that paragraph, I was only talking about cases where "foo = 1" *isn't* a valid override (which, I hope you'll agree, it typically won't be). Your described approach of declaring an abstract property and then overriding it with an or

[issue11610] Improved support for abstract base classes with descriptors

2011-06-12 Thread Nick Coghlan
Nick Coghlan added the comment: Non-conformant explicit registration is permitted on purpose to allow developers to only supply partial implementations when it is known that that is all a given application requires. Extremely impure, but quite practical :) Note that the core logic of

[issue12345] Add math.tau

2011-06-15 Thread Nick Coghlan
New submission from Nick Coghlan : I'd like to add a new constant to the math module: tau = 2*math.pi Rather than repeating all the reasons for why tau makes more sense than pi as the fundamental circle constant, I'll just refer interested readers to http://tauday.com/ -

[issue12345] Add math.tau

2011-06-16 Thread Nick Coghlan
Nick Coghlan added the comment: The golden ratio is more commonly denoted with phi (although tau does get used sometimes). Popularity isn't the point though, it's the fact that tau *makes geometric sense* in ways that 2*pi doesn't. -- ___

[issue12278] Core mentorship mention in the devguide

2011-06-19 Thread Nick Coghlan
Changes by Nick Coghlan : -- assignee: -> ncoghlan ___ Python tracker <http://bugs.python.org/issue12278> ___ ___ Python-bugs-list mailing list Unsubscri

[issue11690] Devguide: Add "communication" FAQ

2011-06-19 Thread Nick Coghlan
Nick Coghlan added the comment: Comms FAQ: http://hg.python.org/devguide/rev/f1ebfb53437f Devguide note: http://hg.python.org/devguide/rev/5ab42baba771 -- resolution: -> fixed stage: -> committed/rejected ___ Python tracker

[issue11795] Better core dev guidelines for committing submitted patches

2011-06-19 Thread Nick Coghlan
Changes by Nick Coghlan : -- resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.or

[issue11690] Devguide: Add "communication" FAQ

2011-06-19 Thread Nick Coghlan
Changes by Nick Coghlan : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue11690> ___ ___ Python-bugs-list mailing list Unsubscri

[issue11795] Better core dev guidelines for committing submitted patches

2011-06-19 Thread Nick Coghlan
Nick Coghlan added the comment: Enhanced committer guidelines: http://hg.python.org/devguide/rev/774fb024b152 -- ___ Python tracker <http://bugs.python.org/issue11

[issue12369] Revised core mentorship section of help.rst

2011-06-20 Thread Nick Coghlan
Nick Coghlan added the comment: Added (with further adjustments) to devguide in http://hg.python.org/devguide/rev/63f3521fe8f8 -- resolution: -> accepted stage: -> committed/rejected status: open -> closed ___ Python track

[issue12370] Use of super overwrites use of __class__ in class namespace

2011-06-20 Thread Nick Coghlan
Nick Coghlan added the comment: And to record the workaround for 3.1 and 3.2 (courtesy of Michael): Adding a "_super = super" alias at the module level and using the Python 2.x style long form invocation on _super() in affected methods will avoid the compiler games played when u

[issue12374] Execution model should explain compile vs definition vs execution time

2011-06-20 Thread Nick Coghlan
New submission from Nick Coghlan : The current execution model documentation in the Language Reference doesn't clearly explain the multiple phases of code execution: 1. Compilation time (statement by statement in the main module and at the interactive prompt, all at once for module impor

[issue12356] more argument error improving

2011-06-23 Thread Nick Coghlan
Nick Coghlan added the comment: Revised error messages and tests look reasonable and the code seems fine on a visual scan. +1 from me. -- ___ Python tracker <http://bugs.python.org/issue12

[issue12399] simplify cell var initialization by storing constant data on the code object

2011-06-24 Thread Nick Coghlan
Nick Coghlan added the comment: Reviewed. General concept looks sound, just suggested a few tweaks around the edges. And issue title updated appropriately :) -- title: make cell var initialization more efficient -> simplify cell var initialization by storing constant data on

[issue12374] Execution model should explain compile vs definition vs execution time

2011-06-24 Thread Nick Coghlan
Nick Coghlan added the comment: Most of my thoughts on this topic can be found at http://svn.python.org/view/sandbox/trunk/userref/ODF/ (that was written ~2.5, so some parts of it are a little dated, but the Essential Concepts section is still fairly accurate). The most relevant part to the

[issue12374] Execution model should explain compile vs definition vs execution time

2011-06-24 Thread Nick Coghlan
Nick Coghlan added the comment: The other directly relevant part is in section 5: 5.1.3 Evaluating Default Arguments In static languages such as C, function definitions are instructions to the compiler rather than executable statements. This leads to such languages making distinctions

[issue12399] simplify cell var initialization by storing constant data on the code object

2011-06-25 Thread Nick Coghlan
Nick Coghlan added the comment: Feel free to create a new issue about the incorrect size calculation on code objects, since it is apparently already broken. -- ___ Python tracker <http://bugs.python.org/issue12

[issue12374] Execution model should explain compile vs definition vs execution time

2011-06-25 Thread Nick Coghlan
Nick Coghlan added the comment: Oh, agreed - the quotes above are from the "Python's User Reference" I wrote several years back, but never got around to converting from ODF and subsequently updating and publishing in a more accessible way. It was designed to fill the gap tha

[issue10845] test_multiprocessing failure under Windows

2011-06-25 Thread Nick Coghlan
Nick Coghlan added the comment: Yeah, the broader issue with multiprocessing, Windows and state held in the main module is covered by PEP 395, so there's no need to double up by keeping this open. -- resolution: -> fixed stage: -> committed/rejected status: ope

[issue11682] PEP 380 reference implementation for 3.3

2011-06-25 Thread Nick Coghlan
Changes by Nick Coghlan : -- assignee: -> ncoghlan ___ Python tracker <http://bugs.python.org/issue11682> ___ ___ Python-bugs-list mailing list Unsubscri

[issue11682] PEP 380 reference implementation for 3.3

2011-06-25 Thread Nick Coghlan
Nick Coghlan added the comment: OK, this isn't going to be as simple as I thought it was. The big problem is that the test suite from [1] needs to be refactored into a format that is suitable for use in regrtest. That means porting them to either unittest or doctest, as "golden out

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-06-26 Thread Nick Coghlan
Nick Coghlan added the comment: The idea of PyManagedBuffer is for it to be an almost completely passive object that *just* acts as a refcounted wrapper around the Py_buffer structure, so it doesn't care about the actual contents. The only supplemental functionality I think it should pr

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-06-26 Thread Nick Coghlan
Nick Coghlan added the comment: I should also note that if memoryview ends up growing enough state to cope correctly with numpy-style multi-dimensional slicing, I'm actually OK with that. You could get a long way just using the array module to allocate a large chunk of memory and t

[issue6673] Uncaught comprehension SyntaxError eats up all memory

2011-06-26 Thread Nick Coghlan
Nick Coghlan added the comment: The acceptance of PEP 380 actually muddies the waters on this one - the expansion I cited as a syntax error now has a defined meaning. Specifically, list comprehensions containing yield expressions would become generators that return a list (set and dict

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-06-27 Thread Nick Coghlan
Nick Coghlan added the comment: I'll try to do a summary of the conversation so far, since it's quite long and hard to follow. The basic issue is that memoryview needs to support copying and slicing that creates a new memoryview object. The major problem with that is that the

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-06-27 Thread Nick Coghlan
Nick Coghlan added the comment: memoryview.release() will raise an exception if you call it when the underlying PyManagedBuffer instance has a refcount > 1. So the explicit memory management still works, and if you mess it up by leaving dangling references around you'll run the

[issue12428] functools test coverage

2011-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: Raymond, do we care whether or not the pure Python version of functools.partial supports inheritance and instance testing? The constructor is technically documented as returning a "partial object" rather than a simple staticmethod instance with

[issue12436] Provide reference to detailed installation instructions

2011-06-28 Thread Nick Coghlan
New submission from Nick Coghlan : The Boston Python Workshop folks have some detailed step-by-step instructions on getting Python up and running ([1]). Given that this can be a pain point for new users (primarily on Windows), it may be good to reference these instructions from the official

[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2011-06-28 Thread Nick Coghlan
Nick Coghlan added the comment: Marking the PEP 380 implementation as a dependency, as I expect it to be easier to update this patch to cope with those changes than it would be the other way around. -- dependencies: +PEP 380 reference implementation for 3.3

[issue11682] PEP 380 reference implementation for 3.3

2011-06-30 Thread Nick Coghlan
Nick Coghlan added the comment: Renaud has updated the patch on bitbucket to incorporate Greg's tests (still in golden output form, but in a unittest/regrtest compatible way). That's a good enough starting point for me - they can be refactored into proper assert based tests later.

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-04 Thread Nick Coghlan
Nick Coghlan added the comment: It might be worth postponing the multi-dimensional support to a second patch, though. If we can get the buffer lifecycle solid first then that provides a better foundation for any further development. -- ___ Python

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-04 Thread Nick Coghlan
Nick Coghlan added the comment: As far as the rule of disallowing shape changes while a buffer is exported, I actually think that's a more sane approach as well. However, I've been burned enough times by going "nobody would be insane enough to rely on that, would they?"

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-04 Thread Nick Coghlan
Nick Coghlan added the comment: Nice work with the patch Stefan - I've added a few review comments (including a suggestion on how to deal with the GetContiguous problem). One idea that review did prompt is that if we aren't going back to the original object for fresh buffer request

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-04 Thread Nick Coghlan
Nick Coghlan added the comment: Is there anything stopping us just storing the flags on PyManagedBuffer? It's OK if the construction API requires the flag information in addition to the Py_buffer struct. -- ___ Python tracker

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-04 Thread Nick Coghlan
Nick Coghlan added the comment: On Tue, Jul 5, 2011 at 12:36 AM, Pauli Virtanen wrote: > Slicing memoryviews can invalidate the contiguity flags, and no-strides > flags, so some checks are still probably needed in `memory_getbuf`. That makes sense, so just as memoryview has its own sha

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: It took me a bit of thinking, but I figured out why the "contiguous" flags imply STRIDES. A quick recap of all the flags: WRITABLE -> error if can't support write access FORMAT -> request format info in Py_buffer struct. Should nev

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: At least, that's the explanation based on the PEP - not sure where "CONTIG" as an alias for ND (N-dimensional) comes from. But then, smalltable was an undocumented novelty, too :) -- ___ Python

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: To address the "should PyManagedBuffer be public?" question: yes, I think so. Given the amount of grief the raw PEP 3118 API has caused the memoryview implementation, I expect the easier lifecycle management provided by the PyObject based API may als

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: Regarding the Reitveld cc field: I tend not to add anyone to that and instead post comments to the tracker item to say that I've finished a review in Reitveld. If people want to see details they can go look at the review itself (or remove themselves fro

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: I don't think that's a bug, it's a missing feature in the integration (there's a request on the metatracker to add automatic notifications of new reviews on the bug itself). I did mention the review above but it would have been easy to mis

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: Moving this discussion out of the review comments: Antoine is wanting to make release() nondeterministic by having the underlying buffer only released when all views using it either have release() called or are no longer referenced. I contend that release

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: If someone is calling release() on all of their views (including slices) than they won't have any problems. The only way they can get into trouble is if they have a slice or copy that they *aren't* explicitly releasing, and in that case they *alrea

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: Oops, Antoine's right, the release() semantics in the patch are broken, albeit for the precisely opposite reasons: that example will actually blow up with BufferError inside some_library_function(). I withdraw my objection - Antoine's right that rele

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-05 Thread Nick Coghlan
Nick Coghlan added the comment: Sorry, I mischaracterised Antoine's suggestion in my last comment. It's more in the nature of ManagedBuffer exposing two APIs: 1. request_release(): tells ManagedBuffer "if I have the last reference, release the buffer now". 2. release():

[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2011-07-06 Thread Nick Coghlan
Nick Coghlan added the comment: Yeah, the reason my originally proposed semantics were wrong is because copying (or slicing) a memoryview object and then explicitly releasing that object would always fail through no fault of that code. That would be broken and the only way to fix it is to

<    1   2   3   4   5   6   7   8   9   10   >