Nick Coghlan added the comment:
A TLS based approach would presumably allow an embedding application like
mod_wsgi to tinker with the state of threads created by naive modules that are
unaware of the existence of subinterpreters.
That said, I don't see anything that prevents us from pur
Nick Coghlan added the comment:
Indeed. I was actually wondering if it would be worth trying to write up a
section for the language reference to describe the cases where a Python
implementation is *expected* to assume reflexive equality. We (IMO) have a
problem at the moment due to
Nick Coghlan added the comment:
There's no point improving the multiple interpreter support if it doesn't help
applications that are currently broken because of that lack of support.
I believe the patch as currently proposed actually makes things *worse*. With
"autoTLSk
Nick Coghlan added the comment:
Added Mark Hammond to the nosy list, as the original author and implementor of
PEP 311 (which added the GILState APIs).
Mark, since your PEP deliberately punted on multiple interpreter support, feel
free to take yourself off the list again. If you spot any
Nick Coghlan added the comment:
Graham - the cases you describe are the things I was saying don't currently
work in my post and wouldn't be helped by Antoine's patch. Your thoughts on how
we could possibly make it work actually parallel mine (although there may be
fun and ga
Nick Coghlan added the comment:
I like the idea of adding these tests as well.
Probably worth bringing up on python-dev - folks like Tarek should definitely
be able to help with alternative ways of building a test application for this.
There is also always the possibility of writing it in
Nick Coghlan added the comment:
Yeah, 7902 was a bug that tried to do an absolute import if an explicit
relative import failed to find anything (i.e. it had inherited the old implicit
relative import fallback, which was entirely inappropriate for the new use
case).
Since the significant
Nick Coghlan added the comment:
Good point - consider that comment revised to refer to the GIL acquisition
counter in the thread state struct. It may just be a matter of having
ThreadState_Swap complain loudly if the gilstate_counter isn't set to a value
it knows how to h
Nick Coghlan added the comment:
Victor, could you please create a Reitveld review for this? The auto-review
creator can't cope with the Git diffs.
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/i
Nick Coghlan added the comment:
OK - I'll wait until that is ready before digging into this.
--
___
Python tracker
<http://bugs.python.org/issue3080>
___
___
Nick Coghlan added the comment:
After applying the patch, doing a make clean and rebuild, I found that
test_importlib fails with a segmentation fault, but the default test suite
otherwise runs without error (that's on Linux with a UTF-8 filesystem, though).
I'll see how a -uall
Nick Coghlan added the comment:
As for the more limited run, I get a clean run with -uall except for the
segfault in test_importlib.
I'll switch to a pydebug build and see how a verbose run of that test fares.
--
___
Python tracker
Nick Coghlan added the comment:
I haven't investigated in detail yet, but this is the final line showing the
failing test:
test_module (importlib.test.builtin.test_loader.LoaderTests) ... Segmentation
fault
--
___
Python tracker
Nick Coghlan added the comment:
Oops, missed that post - that was indeed the problem. With that fixed, tests
are all good on this system. I'll give the patch a look anyway, but I'm going
to have trouble diagnosing things that don't fail on my development machine.
As far as t
Nick Coghlan added the comment:
On Sat, Jan 22, 2011 at 3:08 AM, STINNER Victor wrote:
> I should maybe add some unit tests for non-ASCII module paths and non-ASCII
> module names :-)
Indeed. There are a few tests in test_runpy that could be adapted to
that task fairly easily (it creat
Nick Coghlan added the comment:
For flip, const and identity I agree there are already better ways to handle
them using either itertools or comprehension syntax.
The problem I have with trampoline is that it depends on the function's *return
values* being defined in a certain way
New submission from Nick Coghlan :
The test.support docs are there to help CPython devs with writing good unit
tests more easily. There are a few additions we've made in recent years that
haven't made it into the .rst file, so it is easy to miss useful tools if you
don't go
Nick Coghlan added the comment:
How the conversion from a recursive algorithm to an iterative one works depends
on the specific algorithm involved. A trampoline does the job for tail calls,
but not necessarily any other recursive algorithm.
Factorial actually has a fairly trivial iterative
Nick Coghlan added the comment:
As I recall, STDTESTS is there to check we have a basically functioning
interpreter (i.e. the compiler works, etc). The idea is that if any of those
fail, everything else is likely to go belly up as well. If regrtest is being
used to run some other set of
Nick Coghlan added the comment:
Object instances don't get a __dict__ by default to save the space the pointer
and dict instance would require. Most builtins are missing that pointer. It is
also the main memory saving provided by the use of __slots__.
As far as AttributeError vs Type
Nick Coghlan added the comment:
Along the lines of RDM's last post, see:
http://code.activestate.com/recipes/52308-the-simple-but-handy-collector-of-a-bunch-of-named/
Or, if you do a few web searches for terms like "bethard coghlan namespaces" or
"bethard generic objects
Nick Coghlan added the comment:
verbose isn't a boolean at all - it's an integer. You can supply it multiple
times to bump the logging level up even higher than normal.
~/devel/py3k/Lib/test$ grep "verbose >" *.py
regrtest.py:if self.verbose >
Nick Coghlan added the comment:
There isn't really much "-m test" can do to flag this - multiprocessing is
making assumptions about the meaning of __file__ that may be flat out invalid
when -m is used to execute the main module.
Fixing that properly is going to requi
Nick Coghlan added the comment:
test_warnings actually includes sanity checks for import_fresh_module - they
could be adapted into a separate unit test easily enough.
--
___
Python tracker
<http://bugs.python.org/issue11
Nick Coghlan added the comment:
"Useless" is a rather strong word. Every change we've made to the import system
(or, more accurately, the main module identification system) has been backed up
with decent use cases - nearly all of the subsequent problems can be traced
back to
Nick Coghlan added the comment:
(Replaced patch file to fix a typo in a comment)
--
Added file: http://bugs.python.org/file20603/issue10845_mitigation.diff
___
Python tracker
<http://bugs.python.org/issue10
Changes by Nick Coghlan :
Removed file: http://bugs.python.org/file20601/issue10845_mitigation.diff
___
Python tracker
<http://bugs.python.org/issue10845>
___
___
Pytho
Nick Coghlan added the comment:
Georg, it would be very good to have this fix in for RC2. Otherwise any use of
multiprocessing in conjunction with zipfile, package or directory execution
will fail on Windows in 3.2.
--
assignee: -> georg.brandl
priority: critical -> release b
Nick Coghlan added the comment:
__main__.py files aren't like ordinary modules - they should *not* be defining
classes or anything like that. Instead, they should be treated as if the entire
file was implicitly inside an "if __name__ == '__main__':" clause - when
Nick Coghlan added the comment:
To answer Antoine's question directly:
With the patch, it works just as well as multiprocessing on Windows currently
does if the objects marshalled between parent and
child refer to classes defined inside a "if __name__ == '__main__':&
Nick Coghlan added the comment:
Committed for 3.2 in r88247.
--
___
Python tracker
<http://bugs.python.org/issue10845>
___
___
Python-bugs-list mailing list
Unsub
New submission from Nick Coghlan :
Reviewing the What's New docs, this seemed like the easiest way to give Raymond
a list of things I noticed:
- first sentence in the "ast" module section needs rewording (currently
includes fragments from a couple of different phrasings)
Nick Coghlan added the comment:
A couple more in the Build and CAPI section:
- "The is a new function" should be "There is a new function"
- "The PyUnicode_CompareWithASCIIString() now" either needs to drop the "The"
or add "function" before
Nick Coghlan added the comment:
Another significant logging change: the addition of the "style" parameter for
Formatter objects (allowing the use of str.format and string.Template style
substitution instead of percent formatting)
--
Nick Coghlan added the comment:
The last two logging changes potentially worth mentioning that I noticed:
- simple callables can now be supplied as logging filters (see the version 3.2
note in http://docs.python.org/dev/library/logging#filter-objects)
- the logging API docs now include a
Nick Coghlan added the comment:
I was wrong, I found one more potentially notable logging change:
http://docs.python.org/dev/library/logging#logging.setLogRecordFactory
--
___
Python tracker
<http://bugs.python.org/issue11
Nick Coghlan added the comment:
Adding Vinay, given the number of logging changes in 3.2 that don't appear to
be in the What's New yet (the only logging change noted there at the moment is
the inclusion of PEP 391)
--
nosy: +vinay.sajip
Changes by Nick Coghlan :
--
priority: normal -> high
___
Python tracker
<http://bugs.python.org/issue9931>
___
___
Python-bugs-list mailing list
Unsubscri
Nick Coghlan added the comment:
Correct docs links for LogRecord attributes section:
http://docs.python.org/dev/library/logging#logrecord-attributes
--
___
Python tracker
<http://bugs.python.org/issue11
Changes by Nick Coghlan :
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue8998>
___
___
Python-bugs-list mailing list
Unsubscribe:
Nick Coghlan added the comment:
My fix for the issues with reloading of the _ssl module meant that a couple of
temporary modules weren't getting cleared out of sys.modules properly, thus
confusing the second and later runs of affected tests.
Attached patch adds explicit removal calls fo
Nick Coghlan added the comment:
Helps to add the patch rather than the whole file...
--
Added file: http://bugs.python.org/file20702/issue10971_temp_module_cleanup
___
Python tracker
<http://bugs.python.org/issue10
Changes by Nick Coghlan :
Removed file: http://bugs.python.org/file20701/test_zipimport_support.py
___
Python tracker
<http://bugs.python.org/issue10971>
___
___
Pytho
Nick Coghlan added the comment:
Fixed for 3.2 in r88368 (no backport needed, since the older test suites didn't
exhibit the original problem with the _ssl module reloading)
--
resolution: -> fixed
status: open -> closed
___
Python tra
Nick Coghlan added the comment:
(Georg reviewed the patch after I mentioned it to him on IRC)
--
___
Python tracker
<http://bugs.python.org/issue10971>
___
___
New submission from Nick Coghlan :
There are currently undocumented PyEval_Call* equivalents to a number of the
PyObject_Call* functions.
Since there are resources out there on the web that direct people to use the
currently undocumented PyEval functions, it would be good to document those
Nick Coghlan added the comment:
Removed the easy tag, since this may involve some python-dev discussion as to
where to put them in C API docs (they don't really fit in any of the current
sections).
Perhaps an "advanced APIs" section, for things that most C extension
Nick Coghlan added the comment:
It is, but keep issue 10181 in mind (since that may lead to some restructuring
of the memoryview code, potentially leading to a need to update your patch).
--
___
Python tracker
<http://bugs.python.org/issue5
Nick Coghlan added the comment:
I'm still not comfortable with a convention that relies on *clients* of the PEP
3118 API not mucking with the internals of the Py_buffer struct.
I'm *much* happier with the rule based on malloc/free semantics where the
*pointer* passed to PyObject
Nick Coghlan added the comment:
As far as the question of re-exporting the underlying view or not goes, I agree
having "memoryview(a)" potentially refer to different underlying memory from
"a" itself (because the source object has changed since the first view was
expor
Nick Coghlan added the comment:
I should note that the idea of using a Py_buffer's "internal" field as the
unique ID rather than the Py_buffer's address does have some merit, but I still
overall prefer a design that places fewer constrai
Nick Coghlan added the comment:
On Mon, Feb 14, 2011 at 8:33 AM, Antoine Pitrou wrote:
>> I'm still not comfortable with a convention that relies on *clients*
>> of the PEP 3118 API not mucking with the internals of the Py_buffer
>> struct.
>
> Which clients? Th
Nick Coghlan added the comment:
Another idea we may want to revisit is the PyManagedBuffer concept, which would
be a true PyObject that existed solely to simplify sharing of Py_buffer structs.
If memoryview used such an object internally, then copying and slicing would be
quite simple - just
Nick Coghlan added the comment:
OK, to summarise that revisit into a coherent proposal:
1. Add "PyManagedBuffer" as an even lower level wrapper around Py_buffer. The
only thing this would support is doing GetBuffer on construction and
ReleaseBuffer when destroyed (or when explicitl
Nick Coghlan added the comment:
On further reflection, I realised point 4 in that suggestion isn't reliable in
a formal sense. Consider:
with memoryview(a) as m:
m[:]
The slice won't reference the buffer again, but isn't guaranteed by the
language definition to ha
Nick Coghlan added the comment:
The managed buffer needs to be a separate object so that multiple memoryview
objects can share it. Essentially, we would end up with two APIs - the raw
Py_buffer API and the higher level PyManagedBuffer one.
C extensions would have the choice of using the low
Nick Coghlan added the comment:
If it helps, one way to think of it is that post-redesign, the PyManagedBuffer
would be the "real" API object, with Py_buffer merely a way for data exporters
to provide the information needed to initialise the managed buffer properly.
(That actua
Nick Coghlan added the comment:
On Sun, Feb 20, 2011 at 4:22 AM, Éric Araujo wrote:
> It appears that Misc/NEWS in 3.2 lists the new functions under the 3.1
> section, among other strange differences.
"new in 3.2" changes are relative to 3.1, while 2.7 is relative to
2.6. Th
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Note that this functionality is currently available as follows:
>>> from itertools import count
>>> list(zip(count(3), 'abcdefg')
[(3, 'a'), (4, 'b'), (5, 'c'), (6, 'd
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Mentioning the zip(count(start), itr) version in the enumerate() docs
may be a good idea though.
(And of course, in 2.x, it should be izip() rather than zip() to
preserve the memory efficiency of enu
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
I've attached a sample ProxyBase class that delegates all of the special
methods handled by weakref.proxy (as well as the tp_oct and tp_hex
slots, which weakref.proxy ignores).
While there are other special methods in CPython (e.g
New submission from Nick Coghlan <[EMAIL PROTECTED]>:
The rich compare implementation for set objects raises TypeError
directly instead of returning NotImplemented to allow the other type
involved in the comparison a chance at handling the operation.
--
messages: 67152
nosy: nc
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Eh, never mind, raising the TypeError explicitly is necessary due to the
misbehaviour of the default comparisons in 2.x.
I'll work around the problem in my test case.
--
resolution: -> invalid
status:
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Attached a new version of the module, along with a unit test file. The
unit tests caught a bug in the __gt__ implementation. I've also changed
the name to ProxyMixin as suggested by Adam and switched to using a
normal __init__ method
Changes by Nick Coghlan <[EMAIL PROTECTED]>:
Added file: http://bugs.python.org/file10390/test_typetools.py
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.
Changes by Nick Coghlan <[EMAIL PROTECTED]>:
Removed file: http://bugs.python.org/file10385/typetools.py
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Added documentation, and assigned to Barry as release manager for 2.6/3.0.
Also bumped to 'release blocker' status because I think the loss of
classic classes transparent proxying capabilities is a fairly
substantial issue
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Also changed to a library issue instead of a docs issue.
--
components: +Library (Lib) -Documentation
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Correct, this isn't intended to be an all-singing, all-dancing proxy
implementation - it's meant to be a simple solution for local proxies
that want to change the behaviour of a few operations while leaving
other operations
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Specialised? What's specialised about it? It's designed to serve as a
replacement for the simple delegation use cases that are currently met
quite adequately by classic classes, since those are no longer
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
As to the rationale for having it in the standard library: it's because
of the coupling with the implementation of the type() builtin. If a new
slot is added to type() that the interpreter may access without
consulting __getattrib
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
The way to override _deref/_unwrap is to make _target a property on a
ProxyMixin subclass (which reminds me, I want to put in an explicit
test case to make sure that works as intended - I'll use the
weakref-proxy-in-Python as the
Changes by Nick Coghlan <[EMAIL PROTECTED]>:
Added file: http://bugs.python.org/file10438/typetools.py
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.
Changes by Nick Coghlan <[EMAIL PROTECTED]>:
Removed file: http://bugs.python.org/file10389/typetools.py
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.
Changes by Nick Coghlan <[EMAIL PROTECTED]>:
Removed file: http://bugs.python.org/file10390/test_typetools.py
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.
Changes by Nick Coghlan <[EMAIL PROTECTED]>:
Removed file: http://bugs.python.org/file10402/typetools.rst
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Updated test cases and documentation to cover use of a descriptor for
_target in a subclass, and uploaded most recent local copies of all 3 files.
--
keywords: +patch
versions: +Python 3.0 -Python 2.2.1, Python 2.2.2, Python
Changes by Nick Coghlan <[EMAIL PROTECTED]>:
Added file: http://bugs.python.org/file10439/test_typetools.py
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.
New submission from Nick Veitch <[EMAIL PROTECTED]>:
In the whatsnew/3.0.html doc, the example for print is the wrong way
around. Current version reads:
* The :func:`print` function doesn't support the "softspace" feature of
the old ``print`` statement. For e
New submission from Nick Coghlan <[EMAIL PROTECTED]>:
PEP 371 highlighted the non-PEP 8 compliant nature of the threading API.
Since part of that PEP involves updating the multiprocessing API to be
PEP 8 compliant before addition the standard library, the threading API
should also be upda
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
I've attached the latest version of the module as an actual patch
against Python SVN.
It differs slightly from the last version uploaded as separate files, in
that in-place operations on a proxied object will no longer strip the
pr
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Note that I'll be offline for the next few days, so I want be able to
respond to any comments until some time next week.
___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.py
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
The code changes in the patch look pretty good to me (although you
probably want to actually use @wraps inside _old_api!)
There are obviously also documentation and test suite changes that will
be
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Ah, that would answer my #XXX comment regarding that in the patch.
Agreed, the best answer will be to factor out the _rewrap operation into
a new class method. (Next week though...)
___
Python t
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
I'd still be inclined to put a @wraps(meth) decorator on the definition
of the wrapper function (and then override to the supplied name
afterwards) - remember that functools.wraps is a decorator factory
rather than a decorator its
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
As far as I am concerned, the implementation of PyObject_Unicode in
object.c has a bug in it: it should NEVER be retrieving __unicode__ from
the instance object. The implementation of PyObject_Format in abstract.c
shows the correct
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Here's the key difference with the way PyObject_Format looks up the
pseudo-slot method:
PyObject *method = _PyType_Lookup(Py_TYPE(obj),
str__format__);
_PyType_Loo
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Unfortunately, the standard library doesn't tend to do this kind of
delegation (aside from weakref.proxy, which implements the equivalent
code directly in C), so there isn't a lot of standard library code that
will benefit
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
bleh, "application independent decision" in my last post should read
"interpreter implementation dependent decision".
___
Python tracker <[EMAIL PROTECTED]>
<
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
and "__print__" was meant to be "__unicode__"...
___
Python tracker <[EMAIL PROTECTED]>
<
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
And (mainly for Barry's benefit) a quick recap of why I think this is
necessary for Python 3.0:
For performance or correctness reasons, the interpreter is permitted to
bypass the normal __getattribute__ when looking up special meth
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Minor cleanup of Simon's patch attached - aside from a couple of
unneeded whitespace changes, it all looks good to me.
Not checking it in yet, since it isn't critical for this week's beta
release - I'd prefer to lea
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
New patch (proxymixin.diff) uploaded that correctly delegates
__format__, as well as using an overridable return_inplace() method to
generate the inplace operation return values. The _target attribute has
also been made formally part
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Note that I don't make any promises about the correctness of the ReST
formatting in that latest patch - my Doc build is misbehaving at the
moment, and I haven't had a chance to look at what
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
I'm not sure adding a dedicated method slot would be worth the hassle
involved - Py3k drop backs to just the tp_str slot anyway, and the only
thing you gain with a tp_unicode slot over _PyType_Lookup of a
__unicode__ attribute
New submission from Nick Edds <[EMAIL PROTECTED]>:
This is a small patch to the 2to3 tool, replacing some calls to
isinstance (x,y) with type(x) is y in the file pytree.py. Although there
is only a slight performance increase for each time this change is made,
the recursive nature of p
New submission from Nick Coghlan <[EMAIL PROTECTED]>:
Pydoc doesn't display the standard special attributes for packages and
modules (__name__, __file__, __path__).
It shouldn't display PEP 361's new __package__ attribute either.
--
assignee: ncoghlan
components: L
Nick Edds <[EMAIL PROTECTED]> added the comment:
I don't think the improvement falls in margin of error, but maybe I'm
wrong. The problem was that even when just run on a single file,
isinstance was being called upwards of 100,000 times. I guess it doesn't
merit inclusion o
Nick Coghlan <[EMAIL PROTECTED]> added the comment:
Amaury's patch doesn't currently remove the new-in-2.6 code that turns
"tp_hash = NULL" at the C level into "__hash__ = None" at the Python
level. I suspect that will prove to be a problem (and may be the c
New submission from Nick Edds <[EMAIL PROTECTED]>:
This is an optimization in pytree.py specifically for the bare_name
pattern from fix_imports.py. It also has the isinstance change I
previously suggested piggybacked onto it. Because the bare_name pattern
is so massive (764 nodes!), it i
801 - 900 of 6501 matches
Mail list logo