Nick Coghlan added the comment:
Yeah, the general implementation concept I'm thinking of going with for option
2 will use a few helper functions:
url, coerced_to_str = _coerce_to_str(url)
if coerced_to_str:
param = _force_to_str(param) # as appropriate
...
return _undo_coercion(r
Changes by Nick Coghlan :
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue9951>
___
___
Python-bugs-list mailing list
Unsubscribe:
Nick Coghlan added the comment:
Patch generally looks good, but the type of retbuf is incorrect (should be
Py_UNICODE* rather than wchar_t*).
--
___
Python tracker
<http://bugs.python.org/issue9
Nick Coghlan added the comment:
As per RDM's email to python-dev, a better way to create the pseudo_str values
would be by decoding as ascii with a surrogate escape error handler rather than
by decoding as latin-1.
--
___
Python tracker
Nick Coghlan added the comment:
Yeah, I'll have to time it to see how much difference latin-1 vs
surrogateescape makes when the MSB is set in any bytes.
--
___
Python tracker
<http://bugs.python.org/i
Nick Coghlan added the comment:
On Tue, Oct 5, 2010 at 5:32 PM, STINNER Victor wrote:
>
> STINNER Victor added the comment:
>
>> If you were worried about performance, then surrogateescape is certainly
>> much slower than latin1.
>
> If you were really worried a
Nick Coghlan added the comment:
On Wed, Oct 6, 2010 at 2:59 AM, Alexander Belopolsky
wrote:
>
> Alexander Belopolsky added the comment:
>
> I am afraid, for ordinary scripts these modules effectively use option 3. I
> think these modules should remove its own scaffol
Nick Coghlan added the comment:
I've been pondering the idea of adopting a more conservative approach here,
since there are actually two issues:
1. Properly quoted URLs are transferred as pure 7-bit ASCII (due to
percent-encoding of everything else). However, most of the manipul
Nick Coghlan added the comment:
The difference here is the one pointed out in the original post: for a
function, you usually only care about having a value, so if you don't want to
call it, you can just swap in a None value instead. If you need an actual
callable, then "lambda:None
Nick Coghlan added the comment:
Actually, the singleton idea isn't a bad one, but I'd go one step further and
skip the factory function as well. So change that to be:
class NullContext():
... # as per nullcontext in my last message
nullcontext = NullContext()
(with the exam
Nick Coghlan added the comment:
If you can supply a full patch before the end of the month, we should be able
to get this in for 3.2beta1 (currently scheduled for 31 October)
--
___
Python tracker
<http://bugs.python.org/issue10
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
___
Python tracker
<http://bugs.python.org/issue10049>
___
___
Python-bugs-list mailing list
Unsubscri
Nick Coghlan added the comment:
To me, this is more a matter of conceptual completeness than one of practical
utility (ala fractions.Fraction). That said, I *have* personally encountered
the "I only sometimes want to wrap this code in a CM" situation, so it isn't
complet
Nick Coghlan added the comment:
I suggest using sys._xoptions to make it clearer that this is for CPython
specific internal implementation runtime tweaks. We're putting it in sys so
*we* can get at it, not applications.
(It also makes it clear that other implementations aren't
nick caruso added the comment:
--
import StringIO
import tokenize
tokens = []
def fnord(*a):
tokens.append(a)
tokenize.tokenize(StringIO.StringIO("a = 1").readline, fnord)
tokenize.untokenize(tokens)
--
Generates the same
nick caruso added the comment:
Additionally, substituting "a=1\n" for "a=1" results in no assertion and
successful "untokenizing" to "a = 1\n"
--
___
Python tr
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
___
Python tracker
<http://bugs.python.org/issue5178>
___
___
Python-bugs-list mailing list
Unsubscri
Changes by Nick Coghlan :
--
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue8202>
___
___
Python-bugs-list mailing list
Unsubscri
New submission from Nick Coghlan :
During interpreter shutdown, modules can become unusable as module globals are
set to None. This is a problem for tempfile.TemporaryDirectory, as it needs
working os, os.path and stat modules in order to clean up the filesystem.
The class makes a valiant
Nick Coghlan added the comment:
Cleanup of sys and __builtin__ is already delayed - this particular issue could
be fixed by delaying cleanup of a few more modules, along with the proposed
change to GC invocation in issue #1545463.
--
___
Python
Nick Coghlan added the comment:
Committed (with enhanced tests and a few fixes) in r85818
And credit where it's due to test___all__ for picking up a typo in my
adjustment to tempfile.__all__ :)
I created issue #10188 to track the shutdown problem. I'm considering taking
out the
Changes by Nick Coghlan :
--
resolution: -> accepted
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue5178>
___
___
Python-bugs-list
Nick Coghlan added the comment:
Attached a second version of the patch. Notable features:
- uses a coercion-to-str-and-back strategy (using ascii-strict)
- a significantly more comprehensive pass through the urlparse test suite. I'm
happy that the test suite mods are complete with this
Nick Coghlan added the comment:
Unless I hear some reasonable objections within the next week or so, I'm going
to document and commit the ascii-strict coercion approach for beta 1.
The difference in code clarity is such that I'm not even going to try to
benchmark the two approach
Nick Coghlan added the comment:
I find Raymond's perspective persuasive in this case. Feel free to post either
the original idea or my later variant as an ASPN cookbook recipe. (you could
actually combine the two, and use NullContext as an implementation detail of an
optional_cm() fun
Nick Coghlan added the comment:
I'd still like to have another look at this before beta 1, but can't promise
I'll get to it. Unassigning in case someone else has some roundtuits to spare
over the next few weeks.
--
ass
Nick Coghlan added the comment:
R.I.P contextlib.nested (it is gone in 3.2 following the deprecation in 3.1).
The issue is obscure enough that I don't see much value in updating the
documentation for the versions that still contain it in deprecated form.
--
resolution: ->
Nick Coghlan added the comment:
I still think this is a good idea, I'm just not actively working on it. It
might make a good project for someone wanting to get to know the process of
working on CPython without having to deal with anything that is particularly
tricky to under
Nick Coghlan added the comment:
Merging the interfaces for mkdtemp and TemporaryDirectory isn't going to happen.
mkstemp/mkdtemp are for when the user wants to control the lifecycle of the
filesystem entries themselves. (Note that context management on a regular
file-like object only c
Nick Coghlan added the comment:
Unassigning from ping given the lack of comments - I should be able to have a
look at this in time for beta 1
--
assignee: ping -> ncoghlan
___
Python tracker
<http://bugs.python.org/iss
New submission from Nick Coghlan :
Generators can be in four different states that may be relevant to framework
code making use of them (especially as coroutines). This state is all currently
available from Python code, but is rather obscure and could be made readable.
The four states are
Nick Coghlan added the comment:
On Thu, Oct 28, 2010 at 10:55 PM, Antoine Pitrou wrote:
>
> Antoine Pitrou added the comment:
>
> Is it CPython-specific?
The states are not CPython-specific (they're logical states of the
underlying generator), but I don't know if other
Nick Coghlan added the comment:
So something like:
GEN_CREATED, GEN_ACTIVE, GEN_CLOSED = range(3)
def getgeneratorstate(g):
"""Get current state of a generator-iterator.
Possible states are:
GEN_CREATED: Created, waiting to start execution
GEN_ACTIVE: Currently
Nick Coghlan added the comment:
Indeed, the minimal lifecycles are:
GEN_CREATED->GEN_CLOSED (exception thrown in before the generator was even
started)
GEN_CREATED->GEN_RUNNING->GEN_CLOSED (initial next() with internal logic that
skips all yields)
GEN_CREATED->GEN_RUNNING-&g
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
___
Python tracker
<http://bugs.python.org/issue10220>
___
___
Python-bugs-list mailing list
Unsubscri
Nick Coghlan added the comment:
Since it works for me (I tried both r84120, my old 2.7 build from August or so,
and r86033, which is the 2.7 head), we'll need more information. The starting
blurb from the interactive prompt would be a good place to start.
(-m was slightly broken from
Nick Coghlan added the comment:
Note also that site.py runs twice when used with -m: once implicitly during
interpreter startup, and a second time as the main module. Due to the way the
interpreter starts up and figures out sys.path, it is possible for the implicit
import to pick up the
Changes by Nick Coghlan :
--
nosy: +ronaldoussoren
___
Python tracker
<http://bugs.python.org/issue10263>
___
___
Python-bugs-list mailing list
Unsubscribe:
Nick Coghlan added the comment:
r82508 is the correct release binary (created after the error I mentioned above
was fixed).
I've CC'ed Ronald to see if he can shed any light - it may be a platform
specific issue with the way sys.path is
Nick Coghlan added the comment:
No, there won't be another binary release until 2.7.1 comes out. The SVN
revision number ratchets up pretty fast, since it is counting checkins on *all*
branches, even experimental ones.
--
___
Python tracker
Nick Coghlan added the comment:
Yeah, because the internal import system isn't fully exposed, runpy and a
couple of other tools in the standard library rely on the emulation in pkgutil
instead. I know there are some differences between the emulation and the
builtin mechanism on Windo
Nick Coghlan added the comment:
On Wed, Nov 3, 2010 at 2:17 AM, Ron Adam wrote:
>
> Ron Adam added the comment:
>
> Nick, I can update the patch and move the server back into pydoc.py if that
> will help you get this into 3.2 beta.
Yep, probably the best option 3.2 - then m
Nick Coghlan added the comment:
I still like the higher level API concept, although I might not do it exactly
as presented here any more.
Independently of introducing a new parsing API, it would be worthwhile
extracting the parsing tests from the attached module to make sure the
*existing
Nick Coghlan added the comment:
As far as I know, PEP 3118 serves its purpose of allowing extension modules
like numpy and PIL to share data without needing to copy it around all the
time. It's just that memoryview wasn't really part of that purpose (since all
the affected t
Nick Coghlan added the comment:
Read the "Releasing the buffer" section in PEP 3118 again. Unless I'm
misunderstanding you completely, the rules you're asking for are already in
place: those fields are entirely the responsibility of the exporting object,
and it needs t
Nick Coghlan added the comment:
Ah, yes, I see what you mean - because runpy ignores the sys.modules cache (by
design), it won't see the precached module instance placed there by the
bootstrap code.
We actually *could* make this work on our end: if we find an existing module in
sys.mo
Nick Coghlan added the comment:
Hmm, if we're ever creating a new copy of a Py_buffer without calling GetBuffer
again on the original object, then *that* is a bug (exactly comparable to
copying a PyObject pointer without incrementing the reference count - it's OK
if you can gua
Changes by Nick Coghlan :
--
title: get_shape0 in memoryobject.c not checked for error return -> Problems
with Py_buffer management in memoryobject.c (and elsewhere?)
___
Python tracker
<http://bugs.python.org/issu
Nick Coghlan added the comment:
It doesn't help that neither PEP 3118 nor the Py_buffer docs mention the "obj"
member of the Py_buffer struct that refers back to the original object
providing the buffer - that's fairly fundamental to understanding how
Nick Coghlan added the comment:
So the overall to-do list here is sounding like:
1. Document "Py_buffer->obj" appropriately in both the C API documentation and
in PEP 3118
2. Ensure GetBuffer/ReleaseBuffer are used as the moral equivalent of
INCREF/DECREF for Py_buffer objec
Nick Coghlan added the comment:
Just to be clear, even *I* don't think adding urischemes as it stands is a
particularly great idea, and I wrote it. The only reason I haven't closed the
issue is because I'd like to see it mined for additional tests in test_urlparse
a
Nick Coghlan added the comment:
Removing shebang lines from svn completely and only *adding* them during
installation steps as appropriate may be an interesting approach. (I noted that
my grep of my local build found only correct references to python3.2 in the
built scripts directory)
I
Nick Coghlan added the comment:
For the record, my list is from an svn checkout of r86191
--
___
Python tracker
<http://bugs.python.org/issue10318>
___
___
Pytho
Nick Coghlan added the comment:
A few more deeper in the py3k source tree:
Doc/tools/docutils/_string_template_compat.py
Doc/tools/docutils/readers/python/pynodes.py
Doc/tools/sphinx/pycode/pgen2/token.py
Lib/lib2to3/tests/data/different_encoding.py
Adding Georg, since this affects the docs
Changes by Nick Coghlan :
--
assignee: d...@python ->
___
Python tracker
<http://bugs.python.org/issue10318>
___
___
Python-bugs-list mailing list
Unsubscri
Nick Coghlan added the comment:
Reopening as a reminder to myself that I have a new PEP I want to write in this
area. The idea is essentially a lighter weight alternative to PEP 377 that adds
an optional __entered__ method to the context management protocol along the
following lines:
_v
Changes by Nick Coghlan :
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue10329>
___
___
Python-bugs-list mailing list
Unsubscribe:
Nick Coghlan added the comment:
Just a note for myself when I next update the patch: the 2-tuple returned by
defrag needs to be turned into a real result type of its own, and the
decode/encode methods on result objects should be tested explicitly
Nick Coghlan added the comment:
I'd actually started typing out the command to commit this before it finally
clicked that the patch changes public APIs of the pydoc module in incompatible
ways. Sure, they aren't documented, but the fact they aren't protected by an
underscor
Changes by Nick Coghlan :
Added file: http://bugs.python.org/file19534/issue2001_ncoghlan_cleanup.diff
___
Python tracker
<http://bugs.python.org/issue2001>
___
___
Pytho
Nick Coghlan added the comment:
Yeah, I'll ask for feedback on python-dev regarding the API breakage.
If we decide not to break the existing API, I'd suggest the following:
- keep both the old serve() and the old gui() (with DeprecationWarning added to
both) (I'd forgotten yo
Nick Coghlan added the comment:
As per python-dev discussion, we'll keep the old server and GUI implementations
intact (but deprecated). The -g command line option will start the old
implementation, -p and -b will start the new one.
The APIs to activate the new implementation will start
Nick Coghlan added the comment:
Just call warnings.warn with an appropriate message, a category of
DeprecationWarning and a stacklevel of 2 (so the warning will refer to the
function's caller rather than to the pydoc code).
It's basically the example from the warnings
Nick Coghlan added the comment:
As per my response to RDM on python-dev, I think the patch is misguided as it
currently stands.
The traceback on an exception is built up as the stack unwinds. The stack above
the frame containing the exception handler obviously hasn't been unwound yet,
Nick Coghlan added the comment:
If the allframes flag is pursued further, then the stack trace should be added
(with an appropriate header clause) after the entire exception chain has been
printed (including the exception currently being handled
Nick Coghlan added the comment:
Note that after the loop over the values is complete, the final value of tb
should correctly refer to the traceback for the exception currently being
handled regardless of whether or not any chaining is involved.
So moving the stack printing code that is
Nick Coghlan added the comment:
Note that my suggestion was to move the if statement out of the loop as-is: you
would still be pulling the traceback to display from the caught exception
rather than displaying the stack from the current point of execution. If you
want the bottom most point to
Nick Coghlan added the comment:
Antoine's patch looks good to me.
Given the assumptions in the memoryview code, disallowing NULL for the buf
pointer sounds like the right thing to do, even for zero-length buffers.
--
___
Python tracker
Nick Coghlan added the comment:
A SystemError indicates that an internal API was given bogus input or produces
bogus output (i.e. we screwed up somewhere, or a third party is messing with
interfaces they shouldn't be)
If data validation fails for part of the public C API (whether
Nick Coghlan added the comment:
People may use SystemError for other purposes, but the docs are pretty clear it
is only for internal errors that indicate an interpreter bug:
http://docs.python.org/dev/library/exceptions.html#SystemError
Extension modules or an embedding application passing
Nick Coghlan added the comment:
I can definitely confirm that one:
~/devel/py3k$ gcc -I/usr/local/include/python3.3m -o issue11321 issue11321.c
-L/usr/local/lib/python3.3 -lpython3.3m -lm -lpthread -ldl -lutil -rdynamic
~/devel/py3k$ ./issue11321
START
Try import #0 ...SUCCESS
Try import #1
Nick Coghlan added the comment:
I haven't worked out where the error is happening yet, but the 13 allocated
static variables and the complete lack of a module cleanup function aren't
going to be helping matters.
--
___
Python trac
Nick Coghlan added the comment:
Here's a sample stack trace of it blowing up:
Program received signal SIGSEGV, Segmentation fault.
0x00479404 in type_dealloc (type=0x76a82f20) at
Objects/typeobject.c:2523
2523_PyObject_GC_UNTRACK(type);
(gdb) bt
#0 0x004794
Nick Coghlan added the comment:
I like the idea, and it seems to work as expected (i.e. an empty __slots__
doesn't conflict with inheritance from a C defined type or a type with
non-empty __slots__).
However, __slots__ is one of the sections of the type machinery I'm least
familia
Nick Coghlan added the comment:
While Andreas's patch does indeed prevent the crash, there is something more
going on here.
I modified his patch to print out the reference counts immediately after the
new INCREF commands.
With the INCREF commands commented out, it looks like this:
~/
Nick Coghlan added the comment:
Merging this into issue11321 since that relates to the same underlying problem
and includes a simpler test case.
--
nosy: +ncoghlan
resolution: -> duplicate
status: open -> closed
superseder: -> 9th import of module _pickle alway
New submission from Nick Coghlan :
As discussed in issue11321, _pickle allocates a number of module level objects,
but doesn't use the appropriate PEP 3121 mechanisms to manage their lifecycle.
It should be updated to follow the relevant development guidelines in the
document
Nick Coghlan added the comment:
Looking at the example of _struct.c, I'll withdraw my objection to the patch.
The segfault is due to the attempt to destroy a statically allocated type
object, and the only viable solution to that is to ensure the reference count
never drops to 0, even d
Nick Coghlan added the comment:
Given the deprecation of PyEval_ReleaseLock in issue10913, should this be
closed as "out of date"?
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org
Nick Coghlan added the comment:
In that case, the request should probably read "_pickle should implement the
module finalisation protocol, and module finalisation should be designed so
that doing so isn't a recipe for segfaults".
It strikes me as being very similar to the ex
New submission from Nick Coghlan :
Catching ImportError in order to switch to an alternate implementation can mask
real failures in imported modules. Attaching the module name as an attribute
would allow this to be handled correctly by doing something like:
try:
import simplejson
except
Nick Coghlan added the comment:
We might be able to tapdance our way around the issue by falling back to the
old mechanism when dealing with extension modules without
traverse/clear/dealloc methods.
--
___
Python tracker
<http://bugs.python.
New submission from Nick Coghlan :
~/devel/py3k$ ./python -c "compile('1*'*10+'1', 'broken', 'eval')"
Segmentation fault
Going by the gdb stack trace we're blowing the stack due to the recursive
descent in "compiler_visit_expr&qu
Nick Coghlan added the comment:
Updated Lib/test/crashers/compiler_recursion.py to refer back to this issue.
(As well as making it actually crash again on my system - apparently an
expression nested 59k deep wasn't enough to kill the stack here, so I bumped it
to
Nick Coghlan added the comment:
Armin, I'm not sure returning NotImplemented from __iadd__ is a good idea in
this case. It means "+=" on a mutable object may silently fail to mutate
in-place - enabling that seems rather questionable.
--
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
___
Python tracker
<http://bugs.python.org/issue11477>
___
___
Python-bugs-list mailing list
Unsubscri
New submission from Nick Coghlan :
b'' += source gives SystemError instead of SyntaxError
--
messages: 130881
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: b'' += gives SystemError instead of SyntaxError
__
Nick Coghlan added the comment:
Aren't such use cases already covered by assertRaisesRegex?
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/is
Changes by Nick Coghlan :
--
assignee: -> ncoghlan
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue11505>
___
___
Python-bugs-list mai
Changes by Nick Coghlan :
--
nosy: +dmalcolm, ncoghlan
___
Python tracker
<http://bugs.python.org/issue11549>
___
___
Python-bugs-list mailing list
Unsubscribe:
Nick Coghlan added the comment:
There may be some legitimate use cases when embedding Python and you *know*
that the checks performed by the PyObject_* versions aren't needed.
It may also be historical - the PyEval versions may predate the PyObject
Nick Coghlan added the comment:
Michael pointed out that I had completely missed the point of what the "msg"
argument was about. Sorry for the noise.
--
___
Python tracker
<http://bugs.python.o
Nick Coghlan added the comment:
Armin: yeah, I learned better in the course of trying to fix this misbehaviour
in CPython. I've adjusted assorted sq_concat methods to return NotImplemented
in the sandbox where I'm working on this, along with modifying abstract.c to
correctly cope
Nick Coghlan added the comment:
My work in progress is on the respect_LHS_precedence branch in
http://hg.python.org/sandbox/ncoghlan
Current status is that I have tests for correct handling of sq_concat and
sq_repeat, and am close to having sq_concat and sq_inplace_concat behaving
correctly
Nick Coghlan added the comment:
Trying out the hg integration MvL added to Roundup.
--
hgrepos: +3
___
Python tracker
<http://bugs.python.org/issue11477>
___
___
Changes by Nick Coghlan :
--
keywords: +patch
Added file: http://bugs.python.org/file21216/85d7c99fd31e.diff
___
Python tracker
<http://bugs.python.org/issue11
Changes by Nick Coghlan :
Removed file: http://bugs.python.org/file21216/85d7c99fd31e.diff
___
Python tracker
<http://bugs.python.org/issue11477>
___
___
Python-bug
Changes by Nick Coghlan :
Added file: http://bugs.python.org/file21217/b9b7d4c10bc4.diff
___
Python tracker
<http://bugs.python.org/issue11477>
___
___
Python-bugs-list m
Nick Coghlan added the comment:
I generated a patch between my sandbox and the main repository using the rdiff
extension immediately after syncing with the main line of development. ("hg
diff --reverse cpython" where cpython is aliased to the main repository)
This is the output I
Changes by Nick Coghlan :
Added file: http://bugs.python.org/file21220/2f5db44c98f2.diff
___
Python tracker
<http://bugs.python.org/issue11477>
___
___
Python-bugs-list m
501 - 600 of 6501 matches
Mail list logo