[issue8269] Missing return values for PyUnicode C/API functions

2010-03-31 Thread Arnaud Fontaine

Arnaud Fontaine  added the comment:

I meant whether it returns a new reference or not. For instance, documentation 
for PyUnicode_FromObject() and PyUnicode_AsWideChar() states that a new 
reference is returned, but this is most specified for most functions in Unicode 
Object (at least).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8269] Missing return values for PyUnicode C/API functions

2010-03-31 Thread Arnaud Fontaine

Arnaud Fontaine  added the comment:

I meant whether it returns a new reference or not. For instance, documentation 
for PyUnicode_FromObject() and PyUnicode_AsWideChar() states that a new 
reference is returned, but this is not specified for most functions in Unicode 
Object (at least).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3445] Ignore missing attributes in functools.update_wrapper

2010-03-31 Thread Yoann Aubineau

Changes by Yoann Aubineau :


--
nosy: +yaubi

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8240] ssl.SSLSocket.write may fail on non-blocking sockets

2010-03-31 Thread Cyril

Cyril  added the comment:

I had a look at how M2Crypto and pyOpenSSL handled this:

 - M2Crypto has wrappers around SSL_set_mode that let you set the modes you 
want. From their changelog [1], it was required to be able to operate with 
Twisted. By default, though, they only set SSL_MODE_AUTO_RETRY.

 - pyOpenSSL enables everything by default, and there's no set_mode wrapper. 
Here is the relevant code:

/* Some initialization that's required to operate smoothly in Python */
SSL_CTX_set_mode(self->ctx, SSL_MODE_ENABLE_PARTIAL_WRITE |
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER |
SSL_MODE_AUTO_RETRY);

I don't see any other possible alternative. I'm not sure which one is better. 
Implementing a set_mode wrapper with no mode set by default has no 
compatibility issues, although we'd still have that 'bad write retry' OpenSSL 
error.

On the other hand, setting SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER by default is 
easy but we lose some security (and, possibly, some compatibility problems, 
although I doubt anyone relies on the 'bad write retry' error).

What do you think? I'd be ready to write the patch for the set_mode wrapper if 
you want.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8260] When I use codecs.open(...) and f.readline() follow up by f.read() return bad result

2010-03-31 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Buffering applies when writing, not when reading a file.

There is indeed a problem in codecs.py: after a readline(), read() will return 
the content of the internal buffer, and not more.

The "size" parameter is a hint, and should not be used to decide whether the 
character buffer is enough to satisfy the read() request.
Patch is attached, with test.

--
keywords: +patch
nosy: +amaury.forgeotdarc
stage: test needed -> patch review
Added file: http://bugs.python.org/file16705/codecs_read.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8260] When I use codecs.open(...) and f.readline() follow up by f.read() return bad result

2010-03-31 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Amaury Forgeot d'Arc wrote:
> 
> Amaury Forgeot d'Arc  added the comment:
> 
> Buffering applies when writing, not when reading a file.
> 
> There is indeed a problem in codecs.py: after a readline(), read() will 
> return the content of the internal buffer, and not more.
> 
> The "size" parameter is a hint, and should not be used to decide whether the 
> character buffer is enough to satisfy the read() request.
> Patch is attached, with test.

Agreed.

The patch looks good except the if-line should read:

if chars >= 0 and len(self.charbuffer) >= chars:
  ...

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com



::: Try our new mxODBC.Connect Python Database Interface for free ! 

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--
nosy: +lemburg
title: When I use codecs.open(...) and f.readline() follow up by f.read() 
return bad result -> When I use codecs.open(...) and f.readline() follow up by  
  f.read() return bad result

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4256] optparse: provide a simple way to get a programmatically useful list of options

2010-03-31 Thread Filip Gruszczyński

Filip Gruszczyński  added the comment:

Are you saying, that for example for this:

grusz...@gruszczy-laptop:~/Programs/logbuilder$ ./logbuilder --help
Usage: logbuilder [options] repo

Options:
  --version show program's version number and exit
  -h, --helpshow this help message and exit
  -r REGEXP, --regexp=REGEXP
filter revisions using regular expression
  -c CONTAINS, --contains=CONTAINS
filter revisions that doesn't contain given string
  -s START_REV, --start=START_REV
first revision to be used in log
  -e END_REV, --end=END_REV
last revision to be used in log
  -f FILE, --file=FILE  file where result will be stored
  -t TEMPLATE, --template=TEMPLATE
template used to display changes
  -p PURGE, --purge=PURGE
remove parts of a commit messages, that match given
regexp

you would like to get:

grusz...@gruszczy-laptop:~/Programs/logbuilder$ ./logbuilder --help-options

  --version
  -h, --help
  -r, --regexp
  -c, --contains
  -s, --start
  -e, --end
  -f, --file
  -t, --template
  -p, --purge

?

--
nosy: +gruszczy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8260] When I use codecs.open(...) and f.readline() follow up by f.read() return bad result

2010-03-31 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Updated patch.

[I also tried to avoid reading the underlying file if 
len(self.bytebuffer)>=size, but it does not work with multibytes chars when 
size=1]

--
Added file: http://bugs.python.org/file16706/codecs_read-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Tarek Ziadé

New submission from Tarek Ziadé :

Let's move test_support in unittest !

Then maybe, let's expose some of test_support functions into a new class on the 
top of unittest.TestCase, so they can be used via methods.
 
The purpose is power up people when it comes to write test fixtures or work in 
a testing environment. These helpers were built to test Python itself, are 
quite unknown out there. I think it's a shame :)

http://docs.python.org/library/test.html#module-test.test_support

--
assignee: michael.foord
components: Library (Lib)
messages: 101991
nosy: michael.foord, tarek
severity: normal
status: open
title: move test_support into the unittest package
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

Hmmm... I'm not sure moving everything as is is a good idea. Any parts in 
particular you want?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Basically, all the APIs in test_support could live in unittest and the test 
package could only contain the test modules written for Python.

IOW, these tests helpers can help more people than the core devs

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

Not all the APIs are appropriate though, for example TestFailed and TestSkipped 
are not needed. Some of the APIs only make sense for the test_support runner 
and unittest has its own runner now.

I think the proposal needs to be more specific about which APIs you are 
suggesting would be generally useful.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Sure, no need to have the test runner parts.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

So which parts, can you list the ones you think are most important?

At the moment we don't have to maintain backwards compatibility with 
test.test_support as it isn't a 'public' API - so the cost in adding it to the 
standard library is the same as adding any code. Once we do this we are less 
free to modify / evolve the API.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread R. David Murray

R. David Murray  added the comment:

Actually, the list Terek posted a link to is a public doc page, and as was made 
clear in the recent issue about the check_warnings helper, we do have to 
maintain backward compatibility.  

There (should be) undocumented stuff in test_support, purposely left 
undocumented so that we *don't* have to maintain backward compatibility.  
Myself I wish that doc page didn't even exist.  Putting stuff that users can 
use into unittest is a much better idea.

Maybe we could move the appropriate stuff and get rid of the test_support doc 
page altogether.  And when we move stuff to unittest maybe we could take the 
opportunity to clean up any warts in the interfaces.

--
nosy: +georg.brandl, r.david.murray
priority:  -> low
type:  -> feature request

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Florent Xicluna

Florent Xicluna  added the comment:

> Maybe we could move the appropriate stuff and get rid of the
> test_support doc page altogether.  And when we move stuff to unittest
> maybe we could take the opportunity to clean up any warts in the
> interfaces.

+1

I don't like the burden of backward compatibility concerns for this kind of 
test helpers.

The "Lib/test/" directory should be exclusively for internal Python tests.
It should be clearly stated in the documentation.

If some helpers are enough generic, they could be moved to unittest.support (or 
unittest.util).

--
nosy: +flox
versions: +Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

Right - that is exactly why I want a specific proposal as to which APIs are 
generally useful and should be considered for moving into unittest.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread R. David Murray

R. David Murray  added the comment:

Nick's point is that we should be testing both the value 0 and the value -1, 
but that we should expect 0 to fail only if zlib.ZLIB_VERSION is less than 
1.2.4.  So you'll need to update your patch to keep the 0 test but put it 
inside an appropriate conditional.

The original problem may be in 2.5, but we are doing security updates only for 
2.5, so the fix won't backported to 2.5.  (At least not by us, distributors are 
of course free to patch their own distributions of earlier python versions.)

I'm not sure what your last comment about the default means.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

Sorry, missed David's comment:

> Maybe we could move the appropriate stuff and get rid of the
> test_support doc page altogether.  And when we move stuff to unittest
> maybe we could take the opportunity to clean up any warts in the
> interfaces.

This I agree with. The question here is deciding what is "the appropriate 
stuff". 

If we have to maintain backwards compatibility in test_support we could just 
leave things in there... (possibly plus deprecation or deprecation via 
documentation.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Yes, let's make things explicit as David said:

- "test" package: tests for Python itself, with private stuff, undocumented. 

- "unittest" package: the test framework that is used by the test package and 
that is public

I'd add a support module in unittest, containing these (maybe renamed and 
consolidated) and deprecate them in test_support:

- is_jython
- TESTFN
- forget
- findfile
- check_warnings
- captured_stdout
- TransientResource
- transient_internet
- EnvironmentVarGuard
- WarningsRecorder
- cpython_only
- temp_cwd
- sortdict

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8233] extend py_compile to compile files from stdin

2010-03-31 Thread Matthias Klose

Changes by Matthias Klose :


--
nosy: +doko

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8233] extend py_compile to compile files from stdin

2010-03-31 Thread Matthias Klose

Changes by Matthias Klose :


--
keywords: +needs review -patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Valerio

Valerio  added the comment:

This was clear. Now i make a new patch and then upload it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

A 'support' sub-module in unittest is ok. I wonder if it is the best name?

- is_jython

This is too specific and ignores the other implementations. This information is 
also available from sys / platform modules. 

-1

- TESTFN

This is a global for setting the directory temporary files are created in? 
Don't think I like the global approach. Which functions is it used by?

- forget

This is the equivalent of sys.modules.pop(module_name, None) but it also 
deletes bytecode. I don't think a bytecode deleting API is needed in unittest.

-1


- findfile

I need to look at the code, don't understand it from the description in the 
docs.

- check_warnings

Could be useful.

- captured_stdout

Could be useful.

- TransientResource

I need to look at how it is used, but sounds useful.

- transient_internet

Not documented, I need to look at the code / how it is used.

- EnvironmentVarGuard

Could be useful.

- WarningsRecorder

Used by catch_warnings I guess.

- cpython_only

Not documented but could be useful.

- temp_cwd

Not documented but could be useful.

- sortdict

Not documented but could be useful.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Tim Golden

Tim Golden  added the comment:

On 31/03/2010 14:20, Michael Foord wrote:

> - TESTFN
>
> This is a global for setting the directory temporary files are created in? 
> Don't think I like the global approach. Which functions is it used by?

It's used *all over the place*. I started trying to rip it out
ages ago but it call got far too intrusive and I just backed
away. ISTR that more recent tests have used NamedTemporaryFile
or something similar, which makes much more sense.

--
nosy: +tim.golden

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Valerio

Changes by Valerio :


Removed file: http://bugs.python.org/file16691/8193.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1083] Confusing error message when dividing timedelta using /

2010-03-31 Thread Miki Tebeka

Miki Tebeka  added the comment:

It's marked on 2.7 due to the following (this is svn 79528)

>>> from datetime import timedelta
>>> d = timedelta(1)
>>> d / 2
datetime.timedelta(0, 43200)
>>> d // 2
datetime.timedelta(0, 43200)
>>> from __future__ import division
>>> d / 2
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for /: 'datetime.timedelta' and 'int'
>>>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

about : cpython_only / is_jython

I think the idea here is to mark some tests as being specific to some 
implementations.

I remember a discussion where we said that we could add in sys or platform the 
name of the implementation and make this somehow future-proof.

I can't recall where we said that...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

Something like this was discussed at the language summit. Now we have the skip 
decorators it is easy to skip tests on certain platforms or only run them on 
certain platforms.

The cpython_only decorator is fine - but I'd prefer a general solution rather 
than is_jython, is_pypy, is_ironpython, etc... Do we yet have a 
sys.implementation or equivalent? We need it. :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Valerio

Valerio  added the comment:

Here's the new patch. It's ok?

--
Added file: http://bugs.python.org/file16707/8193.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

Looks good to me.

--
nosy: +michael.foord

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8274] test_run failing

2010-03-31 Thread Zubin Mithra

New submission from Zubin Mithra :

==
FAIL: test_run (distutils2.tests.test_build_clib.BuildCLibTestCase)
--
Traceback (most recent call last):
  File 
"/media/disk/myWorks/working/distutils2/src/distutils2/tests/test_build_clib.py",
 line 137, in test_run
self.assertTrue('libfoo.a' in os.listdir(build_temp))
AssertionError: False is not True

--
Ran 135 tests in 1.004s

FAILED (failures=1, skipped=4)
Traceback (most recent call last):
  File "runtests.py", line 18, in 
test_main()
  File "runtests.py", line 12, in test_main
run_unittest(distutils2.tests.test_suite())
  File 
"/media/disk/myWorks/working/distutils2/src/distutils2/tests/__init__.py", line 
86, in run_unittest
_run_suite(suite)
  File 
"/media/disk/myWorks/working/distutils2/src/distutils2/tests/__init__.py", line 
66, in _run_suite
raise TestFailed(err)
distutils2.tests.TestFailed: Traceback (most recent call last):
  File 
"/media/disk/myWorks/working/distutils2/src/distutils2/tests/test_build_clib.py",
 line 137, in test_run
self.assertTrue('libfoo.a' in os.listdir(build_temp))
AssertionError: False is not True

--
assignee: tarek
components: Distutils2
messages: 102011
nosy: tarek, zubin71
severity: normal
status: open
title: test_run failing
type: behavior
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Shouldn't it be
  zlib.ZLIB_VERSION < '1.2.4'
rather than
  zlib.ZLIB_VERSION <= '1.2.4'
?

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread Daniel Graña

Changes by Daniel Graña :


--
nosy: +dangra

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread Daniel Graña

Daniel Graña  added the comment:

Some background for this report at 
http://stackoverflow.com/questions/2547262/why-is-python-decode-replacing-more-than-the-invalid-bytes-from-an-encoded-string/2548480

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread R. David Murray

R. David Murray  added the comment:

Are we safe using string comparison here?  How likely is zlib to get into 
double digit release numbers?  (Too bad the version comparison stuff Tarek is 
working on isn't already available.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Note that the exact version which changed the behavior is 1.2.3.5, see 
http://www.zlib.net/ChangeLog.txt
- Use zlib header window size if windowBits is 0 in inflateInit2()

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +lemburg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread R. David Murray

R. David Murray  added the comment:

The else branch of the test should also check that 0 does *not* raise an error.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Ok, actually Python is only echoing the error return from zlib here, so I don't 
seen the point of the conditional. Just always test against -1 and we're done.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8225] Wrong link in xml.etree documentation

2010-03-31 Thread Éric Araujo

Éric Araujo  added the comment:

Hello

Is it ok that the code checks “object.__name__ not in ('xml.etree')”? Looks 
like a failed single-item tuple to me. Besides, what about using a simple “!=”?

Regards

--
nosy: +merwok

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2010-03-31 Thread METAL XXX

METAL XXX  added the comment:

I have a tree:

   A
  / \
 B   C
/ \
D E

which is implemented as a dict

tree = {
  'A': set(['B', 'C']),
  'B': set(['D', 'E']), 
  'C': set(),
  'D': set(),
  'E': set(),
}

I want to sort the nodes.

and I don't know how to write a key function for sort() in this situation

so I write a cmp function:

sorted(tree, cmp=lambda x, y: 1 if x in tree[y] else -1 if y in tree[x] else 0)

and it gets ['A', 'C', 'B', 'E', 'D'].

how to convert cmp to key really confused me and it surely need more typing 
time.

so I disagree the removal

--
nosy: +metal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Valerio

Valerio  added the comment:

@pitrou: because the op have the problem with 1.2.4 version of zlib. By the way 
i had just always test against -1 in my first patch. Make i a new patch with a 
simple correction with -1 in place of 0?

@david: i know, but i'm learning now the TDD, so excuse me if i make mistakes. 
How i check that a function don't raise an error? About the string comparison 
you right, this is the first thing that i thought, but when i looked the type 
of release number, in that moment i thought that the string comparison was ok.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8225] Wrong link in xml.etree documentation

2010-03-31 Thread Brian Curtin

Brian Curtin  added the comment:

Good catch. That was intended to be a single tuple because the other check 
above is a tuple, but because this really only checks one thing it could be a 
!= until its necessary to be a tuple. I'll fix it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2010-03-31 Thread David Albert Torpey

David Albert Torpey  added the comment:

> sorted(tree, cmp=lambda x, y: 1 if x in tree[y] else -1 if y in tree[x] else 
> 0)
>
> and it gets ['A', 'C', 'B', 'E', 'D'].

That cmp function is nonsense and isn't even close to being correct:

>>> from random import shuffle
>>> for i in range(10):
... t = list(tree)
... shuffle(t)
... print sorted(t, cmp=lambda x, y: 1 if x in tree[y] else -1 if y in 
tree[x] else 0)

['E', 'C', 'B', 'D', 'A']
['A', 'D', 'C', 'B', 'E']
['C', 'B', 'E', 'D', 'A']
['E', 'D', 'A', 'C', 'B']
['A', 'B', 'D', 'E', 'C']
['D', 'A', 'E', 'C', 'B']
['C', 'D', 'A', 'B', 'E']
['A', 'C', 'B', 'D', 'E']
['A', 'C', 'B', 'E', 'D']
['A', 'C', 'B', 'D', 'E']

> how to convert cmp to key really confused
> me and it surely need more typing time.

Just cut and paste the recipe.  Simple.

--
nosy: +dtorp

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8225] Wrong link in xml.etree documentation

2010-03-31 Thread Brian Curtin

Brian Curtin  added the comment:

Made the change in r79529 through 79532.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

I guess the term "failing" byte somewhat underdefined.

Page 95 of the standard PDF 
(http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf) suggests to "Replace 
each maximal subpart of an ill-formed subsequence by a single U+FFFD".

Fortunately, they explain what they are after: if a subsequent byte in the 
sequence does not have the high bit set, it's not to be considered part of the 
UTF-8 sequence of the code point.

Implementing that should be fairly straight-forward by adjusting the endinpos 
variable accordingly.

Any takers ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8269] Missing return values for PyUnicode C/API functions

2010-03-31 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Arnaud Fontaine wrote:
> 
> Arnaud Fontaine  added the comment:
> 
> I meant whether it returns a new reference or not. For instance, 
> documentation for PyUnicode_FromObject() and PyUnicode_AsWideChar() states 
> that a new reference is returned, but this is not specified for most 
> functions in Unicode Object (at least).

Patches are welcome !

FWIW: Unless otherwise noted, all Unicode APIs that return a PyObject*
give you a new reference.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Brett Cannon

Brett Cannon  added the comment:

I take the blame on documenting the handful of things in test.support; I 
thought it was a good idea to expose the handful of things that had an actual 
design to them. =)

But yes, we should probably shift to test.support to being private and simply 
exposing the stuff that we want to support to another module, although this 
stuff is not unittest-specific; its just testing utility functions. testlib or 
testutils would be a better place.

And we should make sure we are *very* comfortable supporting whatever we move 
over and that it has a good API as test.support has been a dumping ground for 
so long that most of that stuff should not get exposed (and honestly should get 
ripped out or cleaned up; TESTFN is just bad for instance).

--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2010-03-31 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Michael Foord

Michael Foord  added the comment:

I think namespacing utility functions / classes inside unittest is fine (even 
good), but agree that there needs to be careful thinking about APIs that are 
made public in this way. To a certain extent this code has already proved its 
utility, but up until now it hasn't needed to be *generally* useful (and as 
brett says - some of the code in test_support would be better off dead).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8275] callback function on win64 results in bad behavior. mem leak?

2010-03-31 Thread Jasmit

New submission from Jasmit :

I am testing a wrapper on Windows 64 and it seems to result in an null pointer 
access error ONLY when I insert a print statement in the C code.  I have tested 
the wrapper with Python 2.6 and Python 2.7a4.  In addition, I have compiled 
Python 2.6.5 source code and ONLY the release version results in an error.  I 
think the issue is with memcpy(obj->b_ptr, *pArgs, dict->size) (callbacks.c).  
pArgs seem to be  corrupted.  However, I am only looking at the code for the 
first time and I might be off base.

The following is Python and C code to reproduce the bug.  To resolve, please 
comment printf statement in jfunc (C function).

Python Code:
from ctypes import *
def fcn(m,n,x,f):
print "IN Python function fcn "
print f[0]

m=3
n=1
pydlltest=cdll.pydlltest
pydlltest.jfunc.restype = POINTER(c_double)
evalstring = 'pydlltest.jfunc('
TMP_FCN=CFUNCTYPE(None,c_int,c_int,POINTER(c_double),POINTER(c_double))
tmp_fcn=TMP_FCN(fcn)
state=[TMP_FCN,tmp_fcn]
evalstring += 'tmp_fcn'
evalstring +=','
evalstring +='c_int(m)'
evalstring +=','
evalstring +='c_int(n)'
evalstring += ')'
print "evalstring=",evalstring
result = eval(evalstring)

C code:
#include 
__declspec(dllexport) double *jfunc(void (*fcn) (int,int,double 
[],double[]),int m,int n);

double *jfunc(void (*fcn) (int,int,double [],double []),int m,int n)
{
double *fvec=NULL;
double *xguess = NULL;
int i = 0;
int j = 0;
/* comment the line below to fix the resulting null pointer access 
error */
printf("In j func .\n");
fvec = (double *) malloc (m * sizeof (double));
xguess = (double *) malloc (n * sizeof (double));
for (i = 0; i < n; i++){
   xguess[i] = 0.123;
}
(*fcn) (m, n, xguess, fvec);
return fvec;
}

--
assignee: theller
components: ctypes
files: ctype_win64.txt
messages: 102028
nosy: ocrush, theller
severity: normal
status: open
title: callback function on win64 results in bad behavior. mem leak?
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file16708/ctype_win64.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7347] Add {Create|Delete}KeyEx to _winreg, doc and test updates

2010-03-31 Thread Brian Curtin

Brian Curtin  added the comment:

Gabriel, besides the *Ex naming, do you see anything wrong with the rest of the 
patch? I'd like to try and get this into 2.7 before the upcoming beta.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2010-03-31 Thread METAL XXX

METAL XXX  added the comment:

Sorry I ripped the code from a mess and I forget the tree is "leaflized" as

tree = {
  'A': set(['B', 'C', 'D', 'E']),
  'B': set(['D', 'E']), 
  'C': set(),
  'D': set(),
  'E': set(),
}

I don't want to talk about the actual problem. I think sometime 
it's hard to give an "absolute" weight value as key, for this example,
is the relationship in graph. Then user have to "Copy and paste the recipe" to 
get a cmp function which should be already there. We are
all adults here, why don't SIMPLELY tell the newbie don't use cmp() use key() 
unless you know what you are doing.


Thanks for reply.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8275] callback function on win64 results in bad behavior. mem corruption?

2010-03-31 Thread Jasmit

Changes by Jasmit :


--
title: callback function on win64 results in bad behavior. mem leak? -> 
callback function on win64 results in bad behavior. mem corruption?

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2010-03-31 Thread R. David Murray

R. David Murray  added the comment:

cmp is gone.  It's chances of coming back are close enough to zero that an 
assertAlmostEqual test will pass :).  The rest of the discussion should move to 
one of the general python lists.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8233] extend py_compile to compile files from stdin

2010-03-31 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Slightly modified, patch committed to trunk in r79533

--
keywords: +patch -needs review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8273] move test_support into the unittest package

2010-03-31 Thread Ezio Melotti

Ezio Melotti  added the comment:

I agree that some things can be moved in unittest, however several of the 
function in test_support are designed specifically for being used for the 
python test suite. For example temp_cwd is something that could be really 
useful in unittest in my opinion, however we designed it looking at our use 
cases. We limited its utility to what we needed and we didn't document it so 
that we are free to change it if/when the use cases change.

On a side node, sortdict() is probably useless now that we have 
assertDictEqual().

--
nosy: +ezio.melotti

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8233] extend py_compile to compile files from stdin

2010-03-31 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

r79536 in py3k

--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8268] Make old-style classes weak referenceable

2010-03-31 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Fixed in r79535.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2521] ABC caches should use weak refs

2010-03-31 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Make old-style classes weak-referenceable

Now done (r79535).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2521] ABC caches should use weak refs

2010-03-31 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

Cool!  I will revise the patch based on your comments about my test case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8276] useless PyEval_CallObject function

2010-03-31 Thread Maciek Fijalkowski

New submission from Maciek Fijalkowski :

In ceval.c there is such code:

PyObject *
PyEval_CallObject(PyObject *func, PyObject *arg)
{
return PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL);
}
#define PyEval_CallObject(func,arg) \
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)

Is this needed any longer? (both #define and function have the same name)

--
components: Interpreter Core
messages: 102038
nosy: fijal
severity: normal
status: open
title: useless PyEval_CallObject function
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8276] useless PyEval_CallObject function

2010-03-31 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, #defines are not exported in shared libraries. I suppose 
PyEval_CallObject() was part of an old definition of the Python C-API and it 
was kept for compatibility.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8276] useless PyEval_CallObject function

2010-03-31 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The #define dates back from 2007, this changeset:

branch:  trunk
user:guido
date:Sat Aug 30 17:02:50 1997 +0200
files:   Include/ceval.h Python/ceval.c
description:
[svn r8683] Inline PyObject_CallObject (Marc-Andre Lemburg).

--
nosy: +lemburg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8276] useless PyEval_CallObject function

2010-03-31 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Antoine Pitrou wrote:
> 
> Antoine Pitrou  added the comment:
> 
> The #define dates back from 2007, this changeset:
> 
> branch:  trunk
> user:guido
> date:Sat Aug 30 17:02:50 1997 +0200
> files:   Include/ceval.h Python/ceval.c
> description:
> [svn r8683] Inline PyObject_CallObject (Marc-Andre Lemburg).

That's not useless: it's a typical backwards compatibility macro
to auto-upgrade existing software via recompile.

It's also still used a lot in the Python source code and elsewhere:

http://www.google.de/search?q=PyEval_CallObject

The function PyEval_CallObject() can probably be removed by
now, though.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-03-31 Thread Matthew Barnett

Matthew Barnett  added the comment:

issue2636-20100331.zip is a new version of the regex module.

It includes speed-ups and a minor bugfix.

--
Added file: http://bugs.python.org/file16709/issue2636-20100331.zip

___
Python tracker 
<http://bugs.python.org/issue2636>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7946] Convoy effect with I/O bound threads and New GIL

2010-03-31 Thread Nir Aides

Changes by Nir Aides :


Removed file: http://bugs.python.org/file16680/bfs.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7946] Convoy effect with I/O bound threads and New GIL

2010-03-31 Thread Nir Aides

Nir Aides  added the comment:

I upload a new update to bfs.patch which improves scheduling and reduces 
overhead.

--
Added file: http://bugs.python.org/file16710/bfs.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Valerio

Changes by Valerio :


Removed file: http://bugs.python.org/file16707/8193.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8193] test_zlib fails with zlib 1.2.4

2010-03-31 Thread Valerio

Valerio  added the comment:

While i wait for what i have to do, i corrected the patch. But there is a 
problem: the version of zlib '1.2.3.3' raise an error on "distutils.version" 
module. The problem is caused by the regex expression in the 
"distutils.version" module:

version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
re.VERBOSE)

this expression don't match with the type of version that zlib.ZLIB_VERSION 
return.

--
Added file: http://bugs.python.org/file16711/8193.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7092] Test suite emits many DeprecationWarnings when -3 is enabled

2010-03-31 Thread Florent Xicluna

Florent Xicluna  added the comment:

Now the "-Wd" and "-3" flags are active on some buildbots.
And the first failures ...


Need to backport fixes from py3k branch for:
- cgitb "SyntaxWarning: tuple parameter unpacking has been removed in 3.x"
- idlelib "reduce() not supported in 3.x; use functools.reduce()"


And test_multiprocessing is failing on: "sys.exc_clear() not supported in 3.x; 
use except clauses"

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7583] doctest should normalize tabs when comparing output

2010-03-31 Thread anatoly techtonik

Changes by anatoly techtonik :


--
keywords: +patch
Added file: http://bugs.python.org/file16712/issue7583.doctest.tabs.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7583] [patch] doctest should normalize tabs when comparing output

2010-03-31 Thread anatoly techtonik

Changes by anatoly techtonik :


--
title: doctest should normalize tabs when comparing output -> [patch] doctest 
should normalize tabs when comparing output

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7585] [patch] difflib should separate filename from timestamp with tab

2010-03-31 Thread anatoly techtonik

anatoly techtonik  added the comment:

depends on issue #7583

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2521] ABC caches should use weak refs

2010-03-31 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


Added file: http://bugs.python.org/file16713/abc_leak.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2521] ABC caches should use weak refs

2010-03-31 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

New patches uploaded.  I separated out the patch to add the test case, to make 
it easier to test before and after applying the fix.

--
Added file: http://bugs.python.org/file16714/leak_test.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2521] ABC caches should use weak refs

2010-03-31 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


Removed file: http://bugs.python.org/file16690/abc_leak.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7583] [patch] doctest should normalize tabs when comparing output

2010-03-31 Thread anatoly techtonik

anatoly techtonik  added the comment:

http://codereview.appspot.com/848043/show

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7443] test.support.unlink issue on Windows platform

2010-03-31 Thread anatoly techtonik

anatoly techtonik  added the comment:

It would be nice to see standalone test case that illustrates the problem.

--
nosy: +techtonik

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8276] useless PyEval_CallObject function

2010-03-31 Thread Maciek Fijalkowski

Maciek Fijalkowski  added the comment:

Yeah, I meant the function. Sorry for not being specific enough. I suppose the 
function is there to preserve ABI, but definitely code needed recompilation 
since 2007.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8277] ElementTree won't parse comments

2010-03-31 Thread Patrick W.

New submission from Patrick W. :

When using xml.etree.ElementTree to parse external XML files, all XML comments 
within that file are being stripped out. I guess that happens because there is 
no comment handler in the expat parser.

Example:

test.xml


  
  
  


test.py
---
from xml.etree import ElementTree
with open( 'test.xml', 'r' ) as f:
xml = ElementTree.parse( f )
ElementTree.dump( xml )

Result
--

  

  


--
components: XML
messages: 102051
nosy: poke
severity: normal
status: open
title: ElementTree won't parse comments
type: behavior
versions: Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] Fix typos and phrasing in the Web servers howto

2010-03-31 Thread Ezio Melotti

Ezio Melotti  added the comment:

There's also an invalid link to an image just after the title "The low-level 
view":
-.. .. image:: http.png
+.. image:: http.png

The image is not there though, and in r66294 only the document has been added.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] Fix typos and phrasing in the Web servers howto

2010-03-31 Thread Éric Araujo

Éric Araujo  added the comment:

This is a reST comment.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] Fix typos and phrasing in the Web servers howto

2010-03-31 Thread Ezio Melotti

Ezio Melotti  added the comment:

If the image is missing, then the whole line can be removed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] Fix typos and phrasing in the Web servers howto

2010-03-31 Thread Éric Araujo

Éric Araujo  added the comment:

Is there a main author for this fileN? If so, they can say whether they left 
the link as a reminder to put the image back later, or if they were just afraid 
of real version control <0.4 wink>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8218] Fix typos and phrasing in the Web servers howto

2010-03-31 Thread Ezio Melotti

Ezio Melotti  added the comment:

The author is Marek Kubica, but he doesn't seem to be registered to this 
tracker.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1578269] Add os.symlink() and os.path.islink() support for Windows

2010-03-31 Thread Brian Curtin

Brian Curtin  added the comment:

One last issue to solve before this goes in and I start the 
backport...test_tarfile.test_extract_hardlink is intermittently failing for me, 
which was an issue for Eric and I on an earlier version of Jason's patch. 
Sometimes it fails when run as a part of the whole test suite, and then it'll 
pass when run by itself. Thoughts, anyone? I've spent some time on it and I'm 
not sure what I'm missing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8032] Add gdb7 hooks to make it easier to debug Python

2010-03-31 Thread Dave Malcolm

Dave Malcolm  added the comment:

I'm attaching a new version of the patch (v5), against svn trunk (r79517)

I've been testing these hooks by using "gdb attach" to attach to real-world 
python programs.

When doing this with earlier versions of the hooks, gdb would pause for many 
seconds when printing some values (e.g. during a backtrace).  The issue was 
that "proxyval" scrapes the entire graph of python objects from the inferior 
process into gdb, and then prints it.  As well as being slow, this can be many 
pages of textual output.

To counter this, I've rewritten the pretty-printers to use a stream-based 
approach.  The various PyObjectPtr subclasses have a "write_repr" method that 
writes the represenation to a file-like object whilst they recurse.  I supply a 
file-like object "TruncatedStringIO", which raises an exception after a limit 
is reached: by default 1K of string data.  (some simple subclasses simply reuse 
repr(self.proxyval()) for this, but objects that can follow cross-references 
have their own write_repr implementation).

I've also rewritten frame handling: I eliminated the FrameInfo class, moving 
its functionality to the PyFrameObjectPtr class, and introduced a new "Frame" 
class to wrap gdb.Frame.  This allowed a big simplification of the extension 
commands, and fixed various bugs (involving inlining and optimization)

Within the py-up/py-down and py-bt commands, the code now prefixes Python frame 
printing with C-level frame indexes, to better tie together the C-level and 
Python-level views of the stack.

I've added a couple of new commands:
  * "py-print" - takes a string argument.  It attempts to look up the Python 
variable with that name, and print its value  (it searches first in the locals 
of the current frame, then globals, then builtins).
  * "py-locals" - prints Python local variables; an analog of gdb's "info 
locals"

Other changes since v4:
  * Add a ">" marker to the output of "py-list", indicating the current location
  * Add pretty-printer for PyCFunctionObject ("built-in function" and "built-in 
method")
  * Add selftests for the above
  * Make frame printing fetch information on locals on demand, rather than 
within FrameInfo's __init__ method (the latter is completely gone)
  * Introduce PyObjectPtr.pyop_field method, simplifying the code
  * Change the set/frozenset selftests to remove a reliance on ordering within 
the representation of the members
  * Try to be more robust for the case where PyEval_EvalFrameEx's "f" parameter 
is optimized out (see https://bugzilla.redhat.com/show_bug.cgi?id=556975 )
  * Remove the FIXME in PyLongObjectPtr: I've tested the code on builds with 
both sizeof(digit) == 2 and == 4
  * More selftests for unicode printing

All tests pass on my box (Fedora 12 x86_64 with gdb-7.0.1-33.fc12.x86_64): "Ran 
45 tests in 17.439s"

--
Added file: 
http://bugs.python.org/file16715/add-gdb7-python-hooks-to-trunk-v5.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8032] Add gdb7 hooks to make it easier to debug Python

2010-03-31 Thread Dave Malcolm

Dave Malcolm  added the comment:

Adding diff from v4 to v5, for ease of review.

For my reference, md5sum of v5's hooks:
d3e039bb1279e71e847cc7ade10d3272  python-gdb.py

--
Added file: 
http://bugs.python.org/file16716/diff-of-gdb7-hooks-v5-relative-to-v4.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7885] test_distutils fails if Python built in separate directory

2010-03-31 Thread Dan Dever

Dan Dever  added the comment:

Adding version 2.6

This fails for me with 2.6.5 in the same way.

--
nosy: +dedded
versions: +Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread John Machin

John Machin  added the comment:

@lemburg: "failing byte" seems rather obvious: first byte that you meet that is 
not valid in the current state. I don't understand your explanation, especially 
"does not have the high bit set". I think you mean "is a valid starter byte". 
See example 3 below.

Example 1: F1 80 41 42 43. F1 implies a 4-byte character. 80 is OK. 41 is not 
in 80-BF. It is the "failing byte"; high bit not set. Required action is to 
emit FFFD then resync on the 41, causing 0041 0042 0043 to be emitted. Total 
output: FFFD 0041 0042 0043. Current code emits FFFD 0043.

Example 2: F1 80 FF 42 43. F1 implies a 4-byte character. 80 is OK. FF is not 
in 80-BF. It is the "failing byte". Required action is to emit FFFD then resync 
on the FF. FF is not a valid starter byte, so emit FFFD, and resync on the 42, 
causing 0042 0043 to be emitted. Total output: FFFD FFFD 0042 0043. Current 
code emits FFFD 0043.

Example 3: F1 80 C2 81 43. F1 implies a 4-byte character. 80 is OK. C2 is not 
in 80-BF. It is the "failing byte". Required action is to emit FFFD then resync 
on the C2. C2 and 81 have the high bit set, but C2 is a valid starter byte, and 
remaining bytes are OK, causing 0081 0043 to be emitted. Total output: FFFD 
0081 0043. Current code emits FFFD 0043.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread Ezio Melotti

Ezio Melotti  added the comment:

Having the 'high bit set' means that the first bit is set to 1.
All the continuation bytes (i.e. the 2nd, 3rd or 4th byte in a sequence) have 
the first two bits set to 1 and 0 respectively, so if the first bit is not set 
to 1 then the byte shouldn't be considered part of the sequence.
I'm trying to work on a patch.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread Ezio Melotti

Changes by Ezio Melotti :


--
assignee:  -> ezio.melotti

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread John Machin

John Machin  added the comment:

@ezio.melotti: Your second sentence is true, but it is not the whole truth. 
Bytes in the range C0-FF (whose high bit *is* set) ALSO shouldn't be considered 
part of the sequence because they (like 00-7F) are invalid as continuation 
bytes; they are either starter bytes (C2-F4) or invalid for any purpose (C0-C2 
and F5-FF). Further, some bytes in the range 80-BF are NOT always valid as the 
first continuation byte, it depends on what starter byte they follow.

The simple way of summarising the above is to say that a byte that is not a 
valid continuation byte in the current state ("failing byte") is not a part of 
the current (now known to be invalid) sequence, and the decoder must try again 
("resync") with the failing byte.

Do you agree with my example 3?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-03-31 Thread Ezio Melotti

Ezio Melotti  added the comment:

Yes, right now I'm considering valid all the bytes that start with '10...'. C2 
starts with '11...' so it's a "failing byte".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com