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
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
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 "
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
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."
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
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
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
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)
--
___
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
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
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
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
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
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
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
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
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
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
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
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
Changes by Nick Coghlan :
Added file: http://bugs.python.org/file24213/494c976c41c4.diff
___
Python tracker
<http://bugs.python.org/issue11682>
___
___
Python-bugs-list m
Changes by Nick Coghlan :
Removed file: http://bugs.python.org/file23774/0d1d76f68750.diff
___
Python tracker
<http://bugs.python.org/issue11682>
___
___
Python-bug
Changes by Nick Coghlan :
Removed file: http://bugs.python.org/file24213/494c976c41c4.diff
___
Python tracker
<http://bugs.python.org/issue11682>
___
___
Python-bug
Changes by Nick Coghlan :
Added file: http://bugs.python.org/file24214/f8349cbc1b26.diff
___
Python tracker
<http://bugs.python.org/issue11682>
___
___
Python-bugs-list m
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
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
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
Nick Coghlan added the comment:
Visual scan of the patch in Reitveld looks fine to me.
--
___
Python tracker
<http://bugs.python.org/issue12106>
___
___
Pytho
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue12182>
___
___
Python-bugs-list mai
Changes by Nick Coghlan :
--
nosy: +jnoller, ncoghlan
___
Python tracker
<http://bugs.python.org/issue12174>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Nick Coghlan :
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue12191>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
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
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
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
Nick Coghlan added the comment:
Looks good to me.
--
___
Python tracker
<http://bugs.python.org/issue12199>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Changes by Nick Coghlan :
--
resolution: -> fixed
stage: commit review -> committed/rejected
status: open -> closed
___
Python tracker
<http://bugs.python.or
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
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
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
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
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
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
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
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
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
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
___
Python tracker
<http://bugs.python.org/issue1294232>
___
___
Python-bugs-list mailing list
Unsubscri
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
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
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
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
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
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
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
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/
-
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.
--
___
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
___
Python tracker
<http://bugs.python.org/issue12278>
___
___
Python-bugs-list mailing list
Unsubscri
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
Changes by Nick Coghlan :
--
resolution: -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
___
Python tracker
<http://bugs.python.or
Changes by Nick Coghlan :
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue11690>
___
___
Python-bugs-list mailing list
Unsubscri
Nick Coghlan added the comment:
Enhanced committer guidelines: http://hg.python.org/devguide/rev/774fb024b152
--
___
Python tracker
<http://bugs.python.org/issue11
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
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
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
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
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
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
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
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
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
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
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
___
Python tracker
<http://bugs.python.org/issue11682>
___
___
Python-bugs-list mailing list
Unsubscri
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
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
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
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
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
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
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
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
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
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.
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
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?"
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
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
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
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
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
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
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
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
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
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
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
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():
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
201 - 300 of 6301 matches
Mail list logo