New submission from Virgil Dupras hs...@hardcoded.net:
Currently, there is no (documented) way to easily extract arguments in an
argparse Namespace as a dictionary. This way, it would me easy to interface a
function taking a lot of kwargs like this:
args = parser.parse_args()
my_function
Virgil Dupras hs...@hardcoded.net added the comment:
I went ahead and created a patch (with test and doc) making argparse.Namespace
iterable.
--
keywords: +patch -easy
Added file: http://bugs.python.org/file20648/issue11076.diff
___
Python tracker
Virgil Dupras hs...@hardcoded.net added the comment:
I didn't know about vars() (well, I knew it existed, but never was quite sure
what it did).
Given that I'm not a Python newbie, I'm guessing I'm not alone in this
situation. Maybe that instead of making the Namespace iterable, we should
Virgil Dupras hs...@hardcoded.net added the comment:
Here's a documentation-only patch which adds a section about using vars() to
convert a namespace to a dict.
If this becomes a documentation issue, can we target Python 3.2.1 instead of
Python 3.3?
--
Added file: http
Virgil Dupras added the comment:
I wanted to start contributing to python for quite a while, so here's my very
first try (cleaning out old patchless open tickets).
So, whatever is the final decision on this, here's a patch.
CDATASection.writexml() already raises ValueError when finding
Virgil Dupras added the comment:
It's a very interesting patch. I wonder why it fell into oblivion. stuff
like unicode.normalize('NFC', u'\xe9') was more than twice as fast for
me.
Making sure that all unicode is normalized can be a bottleneck in a lot
of applications (it somewhat is in my
Virgil Dupras added the comment:
If the patch would have better styling (if(onetextnode == True):), correct
the test it breaks, and even better, add new ones, I guess it
would be an acceptable one.
--
nosy: +vdupras
_
Tracker [EMAIL PROTECTED]
http
Virgil Dupras added the comment:
The blog page talked about 503 responses. What about issuing a warning
on these responses? Maybe it would be enough to make developers aware of
the problem?
Or what about in-memory caching of the DTDs? Sure, it wouldn't be as
good as a catalog or anything
Virgil Dupras added the comment:
-1 on the systematic warnings too, but what I was talking about is a
warning that would say The server you are trying to fetch your resource
from is refusing the connection. Don't cha think you misbehave? only on
5xx and 4xx responses, not on every remote
Virgil Dupras added the comment:
+1 I've been pulling my hair off over this one too. Try this on win32:
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
import os
os.mkdir(u'foo\xe9')
import
Virgil Dupras added the comment:
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type help, copyright, credits or license for more information.
import hotshot
hotshot.Profile('/tmp/hs').runctx('print len',{'__builtins__
Virgil Dupras added the comment:
oh crap here goes my ego... pasted the wrong line.
_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1149798
_
___
Python-bugs-list mailing
Virgil Dupras added the comment:
Well, since I brought that issue back, I might as well supply a patch. So
if indeed it is decided that hotshot.Profile.runctx() should have
__builtins__ in its globals by default, here is it.
Added file: http://bugs.python.org/file9462
Virgil Dupras added the comment:
The performance gain is rather good:
hsoft-dev:python hsoft$ ./python.exe -m timeit -s import os
os.environ['HOME']
100 loops, best of 3: 1.16 usec per loop
hsoft-dev:python hsoft$ patch -p0 environ-modern.diff
patching file Lib/os.py
hsoft-dev:python
New submission from Virgil Dupras:
What prompted me to do these changes is that Backward compatibility
section for 2.1 and earlier. How long are we going to keep this? According
to svn, no commit has been made on the 2.1 branch since 2003. Is it safe
to assume no unittest change is ever going
New submission from Virgil Dupras:
I've been using unittest for quite a while. One thing I got tired with is
the code duplication for file management and mocking. A few months ago I
created this nifty little TestCase subclass and I've been using it ever
since. It works quite well.
Am I
Virgil Dupras added the comment:
Shouldn't we apply this patch directly on pysqlite? Any change made to
the sqlite3 module will be overwritten in the next refresh, right?
Anyway, I'm not 100% sure, but it might already be fixed:
http://www.initd.org/tracker/pysqlite/changeset/452
So, maybe
Virgil Dupras added the comment:
Isn't it why KeyboardInterrupt is a subclass of BaseException instead of
Exception (along with SystemExit)? so that except Exception: doesn't
catch it?
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2153
Virgil Dupras added the comment:
Oh, you meant hs.path? ah yeah, it's just for tmppath(), which is of no
use except in my own stuff.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2156
Virgil Dupras added the comment:
Well, yeah, but I'm the owner, it's not like if the copyright was a
problem. I'd gladly release it (and the test unit that goes with it) under
BSD.
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2156
Virgil Dupras added the comment:
findTestCases is an obsolete function. From the code:
# Expose obsolete functions for backwards compatibility
__all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases'])
--
nosy: +vdupras
__
Tracker [EMAIL
Virgil Dupras added the comment:
The documentation doesn't say anything about dircmp being supposed to
support pattern matching. This ticket is a feature request rather than a
bug.
--
components: +Library (Lib) -None
nosy: +vdupras
type: behavior - feature request
Virgil Dupras added the comment:
I made a patch to fix the problem. The cleaning up of they weakref keys or
values will be held until all references to iterators created by the
weakdict are dead.
I also couldn't resist removing code duplication of code in items(),
keys() and values
Virgil Dupras added the comment:
Ok then, we need a test for this. Patch attached.
However, I don't know if I applied Amaury's patch wrong or if I miss a
./configure option or something, but even with the patch, the test fails.
Another thing: Why isn't the sqlite3 test suite a part
Virgil Dupras added the comment:
u':memory:'? That already worked before the patch because the implicit
encoding with 'ascii' does not bump into any non-ascii character. Nope,
one has to call connect with a filename containing non-ascii characters.
__
Tracker
Virgil Dupras [EMAIL PROTECTED] added the comment:
Can't we close this ticket?
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2162
__
___
Python-bugs-list mailing list
New submission from Virgil Dupras [EMAIL PROTECTED]:
hsoft-dev:python hsoft$ python
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type help, copyright, credits or license for more information.
from cStringIO import StringIO
StringIO
Virgil Dupras [EMAIL PROTECTED] added the comment:
I had a 54 mb hotshot profile lying around, and it is indeed very long to load,
so I ran a profiling session of
hotshot.stats.load(MY_BIG_FILE) with python and stdlib of r61515, and here are
the results (the resulting prof file
is 27 mb
New submission from Virgil Dupras hs...@hardcoded.net:
If we run 2to3 on the following code:
s = b' '
print s[0] == s
we end up with this:
s = b' '
print(s[0] == s)
However, the first code, under python2 prints True while the converted code,
under python3 prints False.
Shouldn't 2to3
Virgil Dupras hs...@hardcoded.net added the comment:
It looks like this issue has been fixed in issue7105 already. Can we close this
ticket?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue839159
Virgil Dupras hs...@hardcoded.net added the comment:
We might as well backport Antoine's patch rather than take this one (even if
mine for 2.x already). It would be weird to have 2 wildly different patches to
solve the same problem.
Maybe close this ticket and flag issue7105 for backporting
Virgil Dupras hs...@hardcoded.net added the comment:
If I understand the patch correctly, this patch basically add a test for
relative imports. I'm pretty sure this is already testes in importlib.test.
Brett, am I right?
If yes, there's no point in applying this patch.
--
nosy
Virgil Dupras hs...@hardcoded.net added the comment:
Because importlib is already well tested and that it already has the machinery
to test __import__ instead of the importlib code, I suggest that we re-use
importlib's relative tests instead.
Attached is a patch that does this. I made sure
Virgil Dupras hs...@hardcoded.net added the comment:
Applies cleanly on the py3k branch at r83069, the tests work correctly (fail
before applying the patch, success afterwards), and, to the best of my C-API
knowledge, the C code is alright.
Oh, and it behaves as described...
Python 3.2a0
Virgil Dupras hs...@hardcoded.net added the comment:
Oops, used it wrong (but it still works correctly).
p2 = partial(p1, 2)
p2.func, p2.args
(function foo at 0x10051da68, (1, 2))
--
___
Python tracker rep...@bugs.python.org
http
Virgil Dupras hs...@hardcoded.net added the comment:
Brett, I think there's a problem with the tweak you made to the patch. There
was already a testcase called RelativeImportTests and you've hidden it (that I
why I called it ImportlibRelativeImportTests initially
New submission from Virgil Dupras hs...@hardcoded.net:
I downloaded Python 3.1.3rc1 this morning to do my civic duty of testing it. I
don't know what I'm doing wrong, but for me, test_io hangs and never completed.
I'm on OS X 10.6.5. I ran it with:
$ ./python.exe Lib/test/regrtest.py test_io
Virgil Dupras hs...@hardcoded.net added the comment:
I ran the test with the -v option flag. The malloc error don't happen at the
same place the hang up happens. The first one happens at:
test_readline (test.test_io.PyIOTest) ... ok
test_unbounded_file (test.test_io.PyIOTest) ... skipped 'test
Virgil Dupras hs...@hardcoded.net added the comment:
Nobody else can reproduce the bug? I'm not sure I can fix this (although I can
try).
I tried to re-compile 3.1.2 with the same flags and run test_io and it passes,
so something happened between 3.1.2 and 3.1.3rc1.
So, I'll give it a look
Virgil Dupras hs...@hardcoded.net added the comment:
Ooh, darn, that was it. I installed it and afterwards, the tests passed.
Sorry for the fuss, I'll keep that gotcha in mind next time.
--
resolution: - invalid
status: open - closed
___
Python
Virgil Dupras hs...@hardcoded.net added the comment:
Since I last submitted this patch, my leet C skills have improved.
I'm submitting another patch, without the needless PyUnicode creation this
time. (Moreover, I think the previous patch was wrong to insert code before
variable declaration
Virgil Dupras hs...@hardcoded.net added the comment:
Here's another one. I hadn't realized that it was useless to target the 2.x
codebase. So I re-worked this on py3k. The change is non-trivial, since the
non-windows/non-os2 part of the code has significantly changed in 3k. This
time, since
New submission from Virgil Dupras [EMAIL PROTECTED]:
When running with the -3 flag, difflib creates DeprecationWarnings. I
attach a patch fixing them.
There was a note in the code saying DOES NOT WORK for x in a. However,
after my changes, tests still pass, so I removed these notices
Virgil Dupras [EMAIL PROTECTED] added the comment:
It slipped out of my mind that performance was probably important for this
module, so I ditched that nested get call and went if an if..else.
Added file: http://bugs.python.org/file10718/difflib_py3k_deprecation2.diff
Virgil Dupras [EMAIL PROTECTED] added the comment:
hsoft-dev:~ hsoft$ mkdir foobar
hsoft-dev:~ hsoft$ echo baz foobar/baz
hsoft-dev:~ hsoft$ chmod 000 foobar/baz
hsoft-dev:~ hsoft$ python
Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Virgil Dupras [EMAIL PROTECTED] added the comment:
This patch has gone invalid due to some recent conflicting changes. I
remade it and I'm resubmitting it hoping that it will get applied.
Added file: http://bugs.python.org/file11086/unittest_modern2.diff
Virgil Dupras hs...@hardcoded.net added the comment:
I saw this ticket as a good way to get my feet wet (I almost never touched
C) with Python's C API, so I went ahead and did the part for OS X. I also
did the Windows part, but I'm not setup to compile Python on Windows, so I
don't even know
Virgil Dupras hs...@hardcoded.net added the comment:
1. Yeah, I know. At first, that's what I wanted to do, but it resulted
in a lot of code duplication (alloc, memerror, copy), which I didn't
much like. But then again, what I ended up writing (because I realized I
had to decref the new po
Virgil Dupras hs...@hardcoded.net added the comment:
You have to tell the reader how to handle escaping. In your case, you
should send escapechar=\\ in reader()'s kwargs.
--
nosy: +vdupras
___
Python tracker rep...@bugs.python.org
http
New submission from Virgil Dupras hs...@hardcoded.net:
I try to compile Pyhton 3.3a4 on a OS X 10.7 with XCode 4.3.3 and it fails. I
tried a few configuration options, but even with a basic ./configure make,
I get this:
./python.exe -SE -m sysconfig --generate-posix-vars
Could not find
Virgil Dupras hs...@hardcoded.net added the comment:
About duplicated code and performance:
When I look at the duplicated code, I don't see anything that remotely
looks like a performance tweak. Just to make sure, I made a bench:
#!/usr/bin/env python
import sys
sys.path.insert(0, 'Lib
Virgil Dupras hs...@hardcoded.net added the comment:
Oh, that's me again not correctly reading my own tests. It's the
*_are_not_held_* tests that test that no reference is kept.
I agree about the *_flushed_dead_items_* being an implementation detail
Virgil Dupras hs...@hardcoded.net added the comment:
The documentation says:
Another difference from the StringIO module is that calling StringIO()
with a string parameter creates a read-only object. Unlike an object
created without a string parameter, it does not have write methods
Virgil Dupras hs...@hardcoded.net added the comment:
While the behavior cannot be reproduced in the trunk, in can be
reproduced in the 2.6 release:
$ python -W ignore
Python 2.6.1 (r261:67515, Dec 6 2008, 16:42:21)
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type help, copyright
Virgil Dupras hs...@hardcoded.net added the comment:
So, we are talking about adding a feature that could cause problem whether
cleanup is performed before tearDown or after tearDown. Don't we risk
confusing developers who are not familiar with the cleanup order?
Do we really want to add
New submission from Virgil Dupras:
There seems to have been a regression in Python 3.4.1 with pyvenv --upgrade,
and this regression seems to be caused by #21197.
It now seems impossible to use the --upgrade flag without getting a File
exists error. Steps to reproduce:
$ pyvenv env
$ pyvenv
Virgil Dupras added the comment:
I could reproduce the bug on the v3.4.1 tag, on the 3.4 branch and on the
default branch. I think that one of the conditions for the bug to arise is to
have the lib64 symlink created (as described in #21197).
I reproduced the bug on Gentoo and Arch
Virgil Dupras added the comment:
For further references, there's also
https://mail.python.org/pipermail/python-ideas/2014-December/030547.html which
is a deeper discussion and brings even more arguments against it.
Even though I'd love to have some of my code integrated into the core
58 matches
Mail list logo