Nick Coghlan added the comment:
Fixed committed to SVN as r57461
--
resolution: -> fixed
status: open -> closed
_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.o
Nick Coghlan added the comment:
Fixed for 2.6 in rev 58103
(Is the head still being merged to the py3k branch? Or does this need to
be forward-ported manually?)
--
nosy: +ncoghlan
resolution: -> fixed
status: open -> closed
__
Tracker <[EMAIL
Nick Coghlan added the comment:
I like PJE's approach, and the patch works for me.
About the only thing I'd change is to switch the expression in
PyImport_GetImporter to a simple chain of if-statements in order to:
- silence the warning from GCC about an unused value
- make it mo
Changes by Nick Coghlan:
--
assignee: -> ncoghlan
_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1705170>
_
___
Python-bugs-list mailing li
Nick Coghlan added the comment:
Fixed for 2.6 in rev 58766. I'm not sure if it will be possible to get
this into 2.5.2.
Leaving open against 2.5 until it is checked in on the maintenance branch.
--
components: +Library (Lib) -None
resolution: -> accepted
versions: +Py
Nick Coghlan added the comment:
Close, but not quite. The problem is that the 'value' argument may be
None if instantiation of the exception hasn't been forced before
__exit__ gets called.
>>> class TestWith(object):
... def __enter__(self):
... pass
... def
Nick Coghlan added the comment:
I just hit this as well when rerunning the 2.5 tests before checking
something else in. The test itself appears to be fine, but the call to
f.close() outside the try/except block attempting to flush the file to
disk and raising an IOError.
Didn't something
Nick Coghlan added the comment:
Done in rev 58901
--
resolution: accepted -> fixed
status: open -> closed
_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.o
Nick Coghlan added the comment:
I just compared the 2.5 test_resource with the trunk test_resource - the
latter has been modified to remove the file size limitation before it
attempts to close the file, eliminating the test failure without
changing the underlying behaviour of f.close
Nick Coghlan added the comment:
Attached an updated version of PJE's patch with the suggested cleanups
and a new unit test file (test_cmd_line_script.py). Finding the
roundtuits to finish the latter is actually what has taken me so long.
The basic tests and the directory tests are curr
Nick Coghlan added the comment:
I worked out what was wrong with my unit tests (I was incorrectly
including the path information when adding the test script to the zipfile)
I've updated the patch here, and will be committing the change once the
test suite finishes running.
--
ver
Nick Coghlan added the comment:
Committed as rev 59039 (now to see how the buildbots react for other
platforms...)
--
resolution: -> accepted
status: open -> closed
_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.o
Nick Coghlan added the comment:
Reverted status to open until I figure out why the tests are failing on
the Mac OSX buildbot.
--
resolution: accepted ->
status: closed -> open
_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.o
New submission from Nick Coghlan:
Patch to implement PEP 366.
Note that it doesn't implement precisely the semantics described in the
version of the PEP posted in July, as some of those ideas didn't prove
feasible due to the fact that imp.new_module can't tell the difference
Nick Coghlan added the comment:
It wouldn't surprise me at all if the laptop's links were a little off - I
started with a Kubuntu image off VMWare's site quite some time ago, then
dist-upgraded it through a couple of releases a
Nick Coghlan added the comment:
The feature patch for sendmsg/recvmsg support came with a swathe of new tests,
and the failures are in those new tests rather than anything breaking in the
old ones.
As Charles-François noted though, it doesn't look like the feature
implementation itse
Nick Coghlan added the comment:
OK, I've now looked into *why* the socket tests are throwing errors in
tearDown, and it has to do with the way the threaded client/server tests in
test_socket are set up.
Specifically, ThreadableTest uses tearDown to reraise any exception raised in
the c
Nick Coghlan added the comment:
Looking at Daniel's updated patch is still on my to-do list, but I won't object
if anyone else wants to take this forward (it will be at least a few weeks
before I get to it).
--
___
Python trac
Nick Coghlan added the comment:
OK, I'll just deal with the problem directly in test_socket then.
It looks like my latest attempt (suppressing unittest._ExpectedFailure in
test_socket.ThreadableTest.clientRun) did the trick, so I'll push the updated
tests some time this eve
Nick Coghlan added the comment:
As another data point, this question came up again in the context of issue
#12958.
The new test_socket.ThreadableTest uses tearDown() to pick up and reraise any
exception that occurred in the client thread. This meant that my initial
attempts at flagging some
Changes by Nick Coghlan :
--
dependencies: +general pprint rewrite
___
Python tracker
<http://bugs.python.org/issue13004>
___
___
Python-bugs-list mailin
Changes by Nick Coghlan :
Removed file: http://bugs.python.org/file22616/pep380-missing-docs.diff
___
Python tracker
<http://bugs.python.org/issue11682>
___
___
Python-bug
Nick Coghlan added the comment:
Attached patch should now be complete, including the documentation for the new
keyword-only 'file' parameter on various dis module functions.
--
Added file:
http://bugs.python.org/file23197/issue11816_get_opinfo_branch_201
Changes by Nick Coghlan :
Added file: http://bugs.python.org/file22616/pep380-missing-docs.diff
___
Python tracker
<http://bugs.python.org/issue11682>
___
___
Python-bug
Nick Coghlan added the comment:
I have updated the bitbucket repo with changes to address most of Benjamin's
review comments.
A few points of note:
- I agree in principle with the idea of splitting Yield and YieldFrom into
distinct AST nodes, but I'd prefer to focus on getting t
Nick Coghlan added the comment:
'Op' is just an abbreviation of 'operation'. So 'operation code' becomes
'opcode' and 'operation information' becomes 'opinfo'. The fact that it comes
for the 'dis' module gives the context t
New submission from Nick Coghlan :
Based on the python-ideas thread about closures, I realised there are two
features the inspect module could offer to greatly simplify some aspects of
testing closure and generator behaviour:
inspect.getclosure(func)
Returns a dictionary mapping closure
Nick Coghlan added the comment:
Yep, that looks right to me. The eval loop then references those cells from the
frame object during execution.
--
___
Python tracker
<http://bugs.python.org/issue13
Nick Coghlan added the comment:
Huh, I didn't actually realise getclosure() could be written as a one liner
until seeing Meador's version above:
{var : cell.cell_contents for var, cell in zip(func.__code__.co_freevars,
func._
Nick Coghlan added the comment:
These pages are all still on python.org - the links just need to be updated to
point to the devguide equivalents (under http://docs.python.org/devguide)
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.
Nick Coghlan added the comment:
Mostly looks good - couple of minor comments in Reitveld.
As far as the patch flow goes, the 2.x and 3.x branches are actually handled
independently (they're too divergent for merging to make sense).
So 2.7 and 3.2 will be independent commits, then the ch
Nick Coghlan added the comment:
Because a generator can legitimately have no locals:
>>> def gen():
... yield 1
...
>>> g = gen()
>>> g.gi_frame.f_locals
{}
Errors should be reported as exceptions - AttributeError or TypeError if
there's no gi_frame and
Nick Coghlan added the comment:
The function case is simpler - AttributeError or TypeError if there's no
__closure__ attribute, empty mapping if there's no closure.
I've also changed my mind on the "no frame" generator case - since that mapping
will evolve over time
Nick Coghlan added the comment:
Specifically, 2.7.3. A date for that has not yet been set, but somewhere in the
December/January time frame is likely.
--
___
Python tracker
<http://bugs.python.org/issue7
Nick Coghlan added the comment:
If that's the app I think it is (pydoc -g), we're probably going to kill it off
in 3.3 in favour of the -b option.
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.o
Nick Coghlan added the comment:
Slight correction, pydoc.gui() is already gone in current hg tip.
However, this error may be indicative of an underlying problem with
webbrowser.open(url) throwing an exception.
--
___
Python tracker
<h
Nick Coghlan added the comment:
This was from memory, so don't take it as gospel as far as the current
security-fix-only branches go, but here's what I sent to Larry:
-
We maintain two independent heads in hg: 2.7 and default
3.2 is open for general bugfixes
2.5 (
Nick Coghlan added the comment:
The 'using docs' are, oddly enough, the part of the docs called 'using' :)
In particular, the part about the command line components (including the
'
Nick Coghlan added the comment:
(just reviewing the idea here, not the current patch)
The problem of "stale code" (i.e. what was executed doesn't match what is
displayed in the traceback) is a tricky and subtle one. There are a few
different cases:
1. Source displayed does n
Nick Coghlan added the comment:
No, the naming problem had occurred to me as well. Given the 'vars' builtin,
perhaps 'getclosurevars' would do as the name?
--
___
Python tracker
<http://bug
Nick Coghlan added the comment:
In reviewing Meador's patch (which otherwise looks pretty good), I had a
thought about the functionality and signature of getclosurevars().
Currently, it equates "closure" to "nonlocal scope", which isn't really true -
the fu
Nick Coghlan added the comment:
Don't feel bad about not recognising the context - this stuff wasn't documented
at all for a long time, and it wasn't until Georg pointed me to the usage docs
that I realised adding it there would be the right place. I should have
remembered tha
Nick Coghlan added the comment:
This is the same problem that all "from x import y" circular imports have - it
isn't specific to relative imports.
Closing as a duplicate of issue 992389
--
resolution: -> duplicate
status: open -> closed
superseder: -> attrib
Nick Coghlan added the comment:
Changed the issue title to state clearly that the core issue is with circular
imports that attempt to reference module contents at import time, regardless of
the syntactic form used. All of the following module level code can fail due to
this problem
Nick Coghlan added the comment:
It's fairly easy to check this is still a problem:
$ ./python
Python 3.3.0a0 (default:a06ef7ab7321, Sep 22 2011, 13:41:29)
[GCC 4.6.0 20110603 (Red Hat 4.6.0-10)] on linux
Type "help", "copyright", "credits" or "license
Changes by Nick Coghlan :
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/issue8060>
___
___
Python-bugs-list mailing list
Unsubscribe:
Nick Coghlan added the comment:
They were removed because adding new methods to builtin types violated the
language moratorium.
Now that the language moratorium is over, the transform/untransform convenience
APIs should be added again for 3.3. It's an approved change, the original
t
Nick Coghlan added the comment:
Sorry, I meant to state my rationale for the unassignment - I'm assuming this
issue is covered by MAL's recent decision to step away from Unicode and codec
maintenance issues. If that's incorrect, MAL can reclaim the issue, otherwise
unassigning
Nick Coghlan added the comment:
Some further comments after getting back up to speed with the actual status of
this problem (i.e. that we had issues with the error checking and reporting in
the original 3.2 commit).
1. I agree with the position that the codecs module itself is intended to be
Nick Coghlan added the comment:
Oops, typo in my second error example. The command should be:
b'a'.decode('rot_13')
(Since str objects don't offer a decode() method any more)
--
___
Python tracker
<http
Nick Coghlan added the comment:
On Thu, Oct 20, 2011 at 8:34 AM, STINNER Victor wrote:
>> str.transform('bz2') ==> CodecLookupError
>
> A lookup error is surprising here. It may be a TypeError instead. The bz2 can
> be used with .transform, but not on str. So:
Nick Coghlan added the comment:
Features looks good, but the current patch doesn't handle keyword arguments
correctly (more details in the Reitveld review).
--
nosy: +ncoghlan
___
Python tracker
<http://bugs.python.org/is
Nick Coghlan added the comment:
I'm fine with people needing to drop down to the lower level lookup() API if
they want the filtering functionality in Python code. For most purposes,
constraining the expected codec input and output formats really isn't a major
issue - we just need
New submission from Nick Coghlan :
I needed a depth-limited, filtered search of a directory tree recently and came
up with the following wrapper around os.walk that brings in a few niceties like
glob-style filtering, depth limiting and symlink traversal that is safe from
infinite loops. It
Nick Coghlan added the comment:
Looks good to me (although it took me longer than it should have to figure out
why you didn't need to store the keyword argument names a second time)
--
___
Python tracker
<http://bugs.python.org/is
New submission from Nick Coghlan :
Many typical subprocess use cases can now be handled simply via the convenience
functions:
subprocess.call()
subprocess.check_call()
subprocess.check_output()
However, readers of the documentation could be forgiven for not realising that,
since the
New submission from Nick Coghlan :
I've been doing a few systems administration tasks with Python recently, and
shell command invocation directly via the subprocess module is annoyingly
clunky (even with the new convenience APIs).
Since subprocess needs to avoid the shell by defaul
Changes by Nick Coghlan :
--
title: subprocess docs should use emphasise convenience functions -> subprocess
docs should emphasise convenience functions
___
Python tracker
<http://bugs.python.org/issu
Nick Coghlan added the comment:
And that's exactly the problem - a web developer's or security auditor's "shell
injection" is a system administrator's "this language sucks".
These wrappers are the kind of thing you want for shell invocations when us
Nick Coghlan added the comment:
Perhaps a better idea would be to use different names, so it's clearer at the
point of invocation that the shell is being invoked (and hence shell injection
attacks are a potential concern). For example:
shell_call
check_shell_call
check_shell_o
Nick Coghlan added the comment:
Of the 3 available options (mod style, string.Template and str.format), yes,
str.format is the best choice.
If people want the shell meaning of the braces, they can escape them by
doubling them up in the command string
Nick Coghlan added the comment:
Initially, because I was suggesting the names shadow the subprocess convenience
functions so they *had* to live in a different namespace.
However, even after changing the names to explicitly include "shell", I'd like
to keep them away f
Nick Coghlan added the comment:
You couldn't just move them - you'd need to change the wording of how they
cross-link to each other, since the explanations of the convenience function
currently assume you understand how Popen works. I'd like us to get to the
point where y
Nick Coghlan added the comment:
It's a flow thing. This idea was kicked off by the process of translating a
large Perl script to Python and paying attention to what the translation made
*worse*.
One of the big things it made worse was the translation of "qx" (quoted
executab
Nick Coghlan added the comment:
That's a fair point, but I think it actually *improves* the argument for better
helper functions, since we can have them automatically invoke shlex.quote() on
all of the arguments:
def _shell_format(cmd, args, kwds):
args = map(shlex.quote,
Nick Coghlan added the comment:
The devguide actually did align with what I said in my email, but this wasn't
clear if you only read the "Forward Porting" section (you had to read the
"Porting Between Major Versions" section further down the page as well).
I add
Nick Coghlan added the comment:
Fix has been applied to 3.x and hence will be in 3.3 and the next 3.2 release.
I have adjusted the issue metadata to reflect the fact 2,7 still exhibits the
problem, but the patch requires significant work to account for the 3.x vs 2.x
changes in class
Nick Coghlan added the comment:
OK, looking at the code I realised what you're trying to get at is the idea of
reporting the differences between values in a series, such that:
x = list(accumulate(seq))
assert x == list(accumulate(differences(x)))
I don't think the use cases ar
Nick Coghlan added the comment:
Unfortunately, I don't think including implicit shlex.quote() calls is going to
have the effect I was originally looking for:
>>> subprocess.call("du -hs ../py*", shell=True)
593M../py3k
577M../py3k_pristine
479M../python27
Nick Coghlan added the comment:
I'm reasonably happy with the changes I just checked in, but rather than doing
multiple forward ports, my plan is to let them settle for a while, update them
based on any feedback I get, then incorporate the final version into the 3.x
s
Changes by Nick Coghlan :
--
assignee: docs@python -> ncoghlan
___
Python tracker
<http://bugs.python.org/issue13237>
___
___
Python-bugs-list mailing list
Un
Nick Coghlan added the comment:
Considering this further, I've realised that the idea of implicit quoting for
this style of helper function is misguided on another level - the parameters to
be interpolated may not even be strings yet, so attempting to quote them would
Nick Coghlan added the comment:
Without knowing this issue existed, I recently started working on adding some
convenience APIs for shell invocation to shutil:
http://bugs.python.org/issue13238
I think the getstatus and getstatusoutput APIs were copied from the commands
module in 3.0 without
Nick Coghlan added the comment:
I discovered a couple of APIs that were moved from the commands module to the
subprocess module in 3.0:
http://docs.python.org/dev/library/subprocess#subprocess.getstatusoutput
However, they have issues, especially on Windows:
http://bugs.python.org/issue10197
Nick Coghlan added the comment:
After a bit of thought, I realised I could use the string.Formatter API to
implement a custom formatter for the shell command helpers that auto-escapes
whitespace while leaving the other shell metacharacters alone (so you can still
interpolate paths containing
New submission from Nick Coghlan :
I just got bitten by the singularly unhelpful results of doing
inspect.getsource(generator_context_manager).
Now that @functools.wraps adds the __wrapped__ attribute, perhaps
inspect.getsource(f) should follow the wrapper chain by default?
This would affect
Nick Coghlan added the comment:
After a little thought, I think the explicit "unwrap" function is the only
viable approach. Doing the unwrapping implicitly just has too many nasty corner
cases to track down to ensure we aren't losing existing functionality.
I'd also s
Nick Coghlan added the comment:
This feature is unnecessary now that PEP 3147 has been adopted. The way it
works in 3.2+ is that orphaned bytecode files inside __pycache__ are always
ignored, while bytecode files that live directly in the source directories are
always imported.
This handles
Nick Coghlan added the comment:
Absent any further feedback, I think I'm done with the changes to the 2.7
subprocess docs. I'll let them sit for a few days, then do the forward port to
3.2 and default.
There are a couple of additional changes I'll add to the 3.x vers
Nick Coghlan added the comment:
That's deliberate, as I'm only showing a selected subset of the full
signature at that point and using the subprocess API's with positional
arguments would lead to almost incomprehensible code. I'm not in any great
hurry to forward port tho
Nick Coghlan added the comment:
We can only protect people from themselves so much - "shell=True" is invaluable
when you actually want to invoke the shell, and the shell has much better tools
for process invocation and pipeline processing than Python does (since shells
are, in effe
Nick Coghlan added the comment:
As the last checkin message says, I've made the documentation for the helper
functions more self-contained. Each now has its own short "shell=True" warning
with a pointer to the full explanation in the shared parameter description.
There was
Nick Coghlan added the comment:
I realised I could use the convert_field() option in the custom formatter to
choose between several interpolation quoting options:
default - str + shutil.quote_ascii_whitespace
!q - str + shlex.quote
!u - unquoted (i.e. no conversion, str.format default
Nick Coghlan added the comment:
Some examples:
>>> import shutil
>>> shutil.shell_call("du -hs {}", "../py*")
594M../py3k
579M../py3k_pristine
480M../python27
301M../python31
382M../python32
288K../python_swallowed_whole
0
>&
Nick Coghlan added the comment:
The first version I wrote *did* automatically invoke shlex.quote on all
interpolated values, but that breaks wildcard handling. You can see that in the
examples I posted above. With the default whitespace escaping (which allows
spaces in filenames), wildcard
Nick Coghlan added the comment:
Yeah, I was thinking about this a bit more and realised that I'd rejected the
"quote everything by default" approach before I had the idea of providing a
custom conversion specifier to disable the implicit string conversion and
quoting.
So p
New submission from Nick Coghlan :
In a recent python-ideas discussion of the differences between concatenation
and augmented assignment on lists, I pointed out the general guiding principle
behind Python's binary operation semantics was that the type of a binary
operation should not d
New submission from Nick Coghlan :
Currently, sqlite3 allows rows to be easily returned as ordinary tuples
(default) or sqlite3.Row objects (which allow dict-style access).
collections.namedtuple provides a much nicer interface than sqlite3.Row for
accessing ordered data which uses valid
Nick Coghlan added the comment:
Bitbucket repo and attached patch updated relative to current tip.
--
Added file:
http://bugs.python.org/file23569/issue11816_get_opinfo_branch_20111031.diff
___
Python tracker
<http://bugs.python.org/issue11
Changes by Nick Coghlan :
Removed file:
http://bugs.python.org/file23197/issue11816_get_opinfo_branch_20110920.diff
___
Python tracker
<http://bugs.python.org/issue11
Changes by Nick Coghlan :
Removed file:
http://bugs.python.org/file23095/issue11816_get_opinfo_branch_20110904.diff
___
Python tracker
<http://bugs.python.org/issue11
Changes by Nick Coghlan :
Removed file:
http://bugs.python.org/file23019/issue11816_get_opinfo_branch_20110824.diff
___
Python tracker
<http://bugs.python.org/issue11
Changes by Nick Coghlan :
Removed file: http://bugs.python.org/file21599/dis.patch
___
Python tracker
<http://bugs.python.org/issue11816>
___
___
Python-bugs-list mailin
Nick Coghlan added the comment:
Bitbucket repo and attached patch updated relative to latest get_opinfo branch
(which in turn was updated to apply cleanly against current CPython tip).
(I still need to incorporate the doc updates and look into adding keyword
argument support
Changes by Nick Coghlan :
Removed file: http://bugs.python.org/file22616/pep380-missing-docs.diff
___
Python tracker
<http://bugs.python.org/issue11682>
___
___
Python-bug
Changes by Nick Coghlan :
Removed file:
http://bugs.python.org/file23096/issue11682_pep380_branch_20110904.diff
___
Python tracker
<http://bugs.python.org/issue11
New submission from Nick Coghlan :
In discussing the module aliasing PEP on python-ideas, it occurred to me that
we could potentially add some useful "sanity check" utilities to an
"importlib.diagnostics" subpackage. For example:
- scan sys.path looking for entries that
Nick Coghlan added the comment:
We can just use this one - it was more in the nature of a question "is there
anything we want to change about the status quo?" than a request for any
specific change.
I'm actually OK with buffer API based interoperability, but if we're goin
Nick Coghlan added the comment:
I should probably update that posted recipe to my latest version (which adds
"excluded_files" and "excluded_dirs" parameters).
However, since I've been dealing with remote filesystems where os.listdir() and
os.stat() calls from
Nick Coghlan added the comment:
This needs more thought - pypi package coming soon :)
--
___
Python tracker
<http://bugs.python.org/issue13229>
___
___
Python-bug
1 - 100 of 6301 matches
Mail list logo