[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed

2013-07-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think both (PyException_SetContext), as in Python code. See 
textiowrapper_close() in Modules/_io/textio.c for example.

--

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



[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 if
 (perhaps someone is calling your library and passing it the wrong type)
 they would be guarded against this common error.

OTOH, if your library is concerned about unwanted bytes objects, you can add an 
explicit type check.
That said, I don't see any counter-argument against this proposal; only that 
I'm not sure it's very useful.

--
nosy: +pitrou

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



[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't know why your patch is putting this in the thread state, though...

--

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



[issue17911] Extracting tracebacks does too much work

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think ExceptionSummary could be the visible API, instead of adding an 
indirection through a separate global function.
Also, I don't think having the exc_traceback list of tuples is future-proof. 
What if we want to add some information to each traceback entry, or refactor it 
to take __loader__ into account?
Instead, ExceptionSummary could expose the desired operations (e.g. iterate 
over traceback lines and the associated source code lines) without being 
constrained by some implementation details.

--

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



[issue18451] Omit test files in devinabox coverage run

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Is it common practice to ignore test files in coverage reports?
It sounds like not omitting them can help you find out if e.g. some tests are 
not run by mistake.

--
nosy: +pitrou

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



[issue16611] multiple problems with Cookie.py

2013-07-18 Thread Julien Phalip

Julien Phalip added the comment:

I'm attaching a suggested patch to fix the issues relating to 
serializing/deserializing the httponly and secure flags. The main idea is that 
for a flag to be active, it needs to both be set and have the True value.

I think this is a much more correct and saner approach than the current 
implementation. As it's been discussed previously, currently the httponly and 
secure flag are systematically given the empty string as default value when 
instantiating a Morsel object. So one would infer that the empty string means 
that the flags are inactive. However, when deserializing a Morsel object, the 
empty string is used to indicate that a flag is active. Both behaviors 
contradict each other.

While the suggested change is backwards-incompatible, it would break the code 
of developers relying on an inconsistent behavior. So perhaps this might be 
compelling enough to allow breaking backwards compatibility in this case.

Let me know what you think. Thanks!

--
keywords: +patch
nosy: +julien.phalip
versions:  -Python 2.7
Added file: http://bugs.python.org/file30962/cookies-httponly-secure.diff

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



[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks for the patch, I will take a look.

--
stage: needs patch - patch review
versions: +Python 3.4 -Python 3.3

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



[issue14518] Add bcrypt $2a$ to crypt.py

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Apparently, Django supports of variant of that format:
https://docs.djangoproject.com/en/1.4/topics/auth/#using-bcrypt-with-django

--

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



[issue18379] SSLSocket.getpeercert(): OCSP and CRL DP URIs

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Do you have to put those certs in capath? Things would probably be simpler if 
you didn't have to trigger capath loading using an actual SSL connection.
Also, please a versionadded tag in the doc entry.

--

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



[issue18381] unittest warnings counter

2013-07-18 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +rbcollins

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



[issue18425] IDLE Unit test for IdleHistory.py

2013-07-18 Thread R. Jayakrishnan

R. Jayakrishnan added the comment:

Thanks Terry for we have the option of gui tests when mocking becomes too 
complicated

I put two separate classes IdleHistoryMockTest and IdleHistoryTKTest for mock 
and TK text usages and used TK Text to test IdleHistory.history_do function. 
This worked for me and hopefully IMHO the logic behind history_do is tested 
enough for now.

--
Added file: http://bugs.python.org/file30963/test_idlehistory2.patch

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



[issue17214] http.client.HTTPConnection.putrequest encode error

2013-07-18 Thread Vajrasky Kok

Vajrasky Kok added the comment:

The script for demonstrating bug can be simplified to:

---
import urllib.request
url = 
http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc;

req = urllib.request.Request(url)
response = urllib.request.urlopen(req, timeout=30)
the_page = response.read().decode('utf-8')
print(the_page)
---

Attached the simple patch to solve this problem.

The question is whether we should fix this problem in urllib or not because 
strictly speaking the url should be ascii characters only. But if the Firefox 
can open this url, why not urllib?

I will contemplate about this problem and if I (or other people) think that 
urllib should handle url containing non-ascii characters, then I will add 
additional unit test.

Until then, people can use third party package, which is
request package from http://docs.python-requests.org/en/latest/


r = 
requests.get(http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc;)
print(r.text)


--
nosy: +vajrasky
Added file: 
http://bugs.python.org/file30964/patch_to_urllib_handle_non_ascii_char_in_url.txt

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



[issue18490] Error embedding datetime in C++

2013-07-18 Thread abdulet

New submission from abdulet:

Hi all,

I'm ebedding a python program into C++ ecap library. Everything works fine 
until I'v try to import sqlite3. When I try to import it I give the following 
exception:
Traceback (most recent call last):
', '  File /usr/local/squid/bin/putAdds.py, line 4, in module
import sqlite3
', '  File /usr/lib/python2.7/sqlite3/__init__.py, line 24, in module
from dbapi2 import *
', '  File /usr/lib/python2.7/sqlite3/dbapi2.py, line 24, in module
import datetime
', 'ImportError: /usr/lib/python2.7/lib-dynload/datetime.i386-linux-gnu.so: 
undefined symbol: PyExc_SystemError

So it seems that is a problem in datetime module. How can i solve that?

Thanks and regards
Abdul

--
components: Extension Modules
messages: 193280
nosy: abduelt
priority: normal
severity: normal
status: open
title: Error embedding datetime in C++
versions: Python 2.7

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



[issue18490] Error embedding datetime in C++

2013-07-18 Thread Christian Heimes

Christian Heimes added the comment:

Hello Abdulet,

the issue tracker isn't the best place to get help for your problem. May I 
suggest that you write a mail to the Python user list or one of the more 
specialized lists like the CAPI SIG and C++ SIG?

http://mail.python.org/mailman/listinfo

--
nosy: +christian.heimes
resolution:  - invalid
status: open - closed

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



[issue14518] Add bcrypt $2a$ to crypt.py

2013-07-18 Thread Christian Heimes

Christian Heimes added the comment:

The crypt module is just a thin wrapper around crypt(3). Some operating systems 
have support for $2a$ but apparently I don't have one at home. Django uses 
https://code.google.com/p/py-bcrypt/source/browse/#hg%2Fbcrypt

http://linux.die.net/man/3/crypt

--

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



[issue18379] SSLSocket.getpeercert(): OCSP and CRL DP URIs

2013-07-18 Thread Christian Heimes

Christian Heimes added the comment:

It's just one certificate. The hash format of OpenSSL has changed over the 
years so we have to duplicate all certificates. But I don't need the extra 
stuff. I figured out that the Nokia test certificate has all new fields.

My initial patch has a versionchanged doc update. Did you have too much French 
wine again? *scnr* :)

--
Added file: http://bugs.python.org/file30965/ssl_ocsp_crldp2.patch

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



[issue18490] Error embedding datetime in C++

2013-07-18 Thread abdulet

abdulet added the comment:

Ok it looks like a bug for me, sorry for the inconveniences

Thanks and regards
Abdul

TECNOCOM

Abdul Pallarès Calvi

Técnico Especialista

Sistemas gestionados

Entença, 335

Barcelona 08029

Tel. Fijo: (+34) 934953167

Tel. Móvil / Fax: (+34) 647970296 / (+34)

email: abdul.palla...@tecnocom.es

http://www.tecnocom.es

Por favor, antes de imprimir este mensaje, asegúrate de que es necesario. 
Ayudemos a cuidar el medio ambiente
Este mensaje puede contener información confidencial o privilegiada. Si le ha 
llegado por error, rogamos no haga uso del mismo, avise al remitente y bórrelo. 
Consulte aviso legal
This message may contain confidential or privileged information. If it has been 
sent to you in error, please do not use it, notify the sender of the error and 
delete it. SPAN style=FONT-SIZE: 7pt; COLOR: gr


De: Christian Heimes rep...@bugs.python.org
Enviat el: dijous, 18 / juliol / 2013 13:13
Per a: Pallares Calvi, Abdul Sabur
Tema: [issue18490] Error embedding datetime in C++

Christian Heimes added the comment:

Hello Abdulet,

the issue tracker isn't the best place to get help for your problem. May I 
suggest that you write a mail to the Python user list or one of the more 
specialized lists like the CAPI SIG and C++ SIG?

http://mail.python.org/mailman/listinfo

--
nosy: +christian.heimes
resolution:  - invalid
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18490
___

--

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



[issue18379] SSLSocket.getpeercert(): OCSP and CRL DP URIs

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 It's just one certificate.

Indeed, it's just the decision to use capath that I'm arguing with.

 My initial patch has a versionchanged doc update. Did you have too
 much French wine again? *scnr* :)

Not *too much*, no ;-)

--

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



[issue17214] http.client.HTTPConnection.putrequest encode error

2013-07-18 Thread Christian Heimes

Christian Heimes added the comment:

The problem may not be a bug but a deliberate design choice. urllib is rather 
low level and doesn't implement some browser magic. Browsers handle stuff like 
'ä' - '%C3%A4', ' ' - '%20' or IDNA but urllib doesn't. I always saw it as 
may responsibility to quote and encode everything myself. Higher level APIs 
such as requests are free to implement browser magic.

Contrary to common believes an URL with an umlaut or space is *not* a valid 
URI. From 
http://docs.python.org/3/library/urllib.request.html#urllib.request.Request

 url should be a string containing a valid URL.

I suggest that this ticket shall be closed as won't fix.

--
nosy: +christian.heimes

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



[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Daniel Holth

Daniel Holth added the comment:

On Thu, Jul 18, 2013, at 04:22 AM, Antoine Pitrou wrote:
 
 Antoine Pitrou added the comment:
 
 I don't know why your patch is putting this in the thread state,
 though...

If you have multiple threads one thread might want exceptions when
str(bytes), and the other might not.

str(bytes) has been an insidious problem for me. No exceptions,
seemingly working code, and b'' in serialized data. I am motivated to
turn it off.

--

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



[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

  I don't know why your patch is putting this in the thread state,
  though...
 
 If you have multiple threads one thread might want exceptions when
 str(bytes), and the other might not.

That sounds too much of a special case to me. You can still catch
BytesWarnings inside a context manager or something.

--

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



[issue18468] re.group() should never return a bytearray

2013-07-18 Thread Ezio Melotti

Ezio Melotti added the comment:

I'm not sure it's worth changing it.
As I see it, match/search are supposed to work with str or bytes and they 
return str/bytes accordingly.  The fact that they work with other bytes-like 
objects seems to me an undocumented implementation detail people should not 
rely on.
If they are passing bytes-like object, both the current behavior (return same 
type) or the new proposed behavior (always return bytes) seem reasonable 
expectations.

IIUC the advantage of changing the behavior is that it won't keep the target 
string alive anymore, but on the other hand is not backward compatible and 
makes things more difficult for people who want the same type back.
If people always want bytes back regardless of the input, they can convert the 
input or output to bytes explicitly.

--
components: +Regular Expressions
nosy: +ezio.melotti, mrabarnett

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



[issue18451] Omit test files in devinabox coverage run

2013-07-18 Thread Brett Cannon

Brett Cannon added the comment:

The key problem with keeping them is that beginners might mistake that a test 
didn't run simply because some resource wasn't available when the tests were 
run (e.g. I forget to run the coverage report so I do it on an airport to the 
conference and have no Internet). Plus if you find this out you need to know 
hours in advance as a complete coverage run takes quite a while.

--

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



[issue18451] Omit test files in devinabox coverage run

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The key problem with keeping them is that beginners might mistake
 that a test didn't run simply because some resource wasn't available
 when the tests were run (e.g. I forget to run the coverage report so
 I do it on an airport to the conference and have no Internet). Plus
 if you find this out you need to know hours in advance as a complete
 coverage run takes quite a while.

I don't understand what the problem is. The coverage shows you precisely
what was run and what wasn't. How is it a bug?

--

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



[issue18468] re.group() should never return a bytearray

2013-07-18 Thread Matthew Barnett

Matthew Barnett added the comment:

There's also the fact that the match object keeps a reference to the target 
string anyway:

 import re
 t = memoryview(ba)
 t
memory at 0x0100F110
 m = re.match(ba, t)
 m.string
memory at 0x0100F110

On that subject, buried in the source code (_sre.c) is the comment:

/* FIXME: implement setattr(string, None) as a special case (to
   detach the associated string, if any */


In the regex module I added a method detach_string to perform that function.

--

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



[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread R. David Murray

R. David Murray added the comment:

I presume you mean you are motivated to turn it on (to catch the bugs).  I 
still think that also fixing the bugs in the other places str(bytes) is used 
would be better.  Are they occurring in third party libraries?  How often do 
you run into it?

--

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



[issue17911] Extracting tracebacks does too much work

2013-07-18 Thread Björn Sandberg Lynch

Björn Sandberg Lynch added the comment:

I was trying to stay with the established pattern of the existing methods. 
There are two unrelated issues to solve here - deferring linecache access, and 
the extract_exception functionality.

When it comes to deferral, we could wrap each line in a different class than 
tuple, but this constitutes a public API change (and this is a *very* widely 
used library). Even changing to a namedtuple would cause a lot of grief, since 
we'd break lots of doctests, and subclassing tuple is a lot of effort for 
little benefit. If we only do it for the deferred usage, it would only be 
inconsistent. I suppose we could have a completely separate way of doing things 
for ExceptionSummary, but again, inconsistent, and I think if one extract_xxx 
method provides the functionality, users would expect it to be available in the 
others.

For ExceptionSummary, the same summary instance is used more than once if you 
have a cause set, so object creation had to be separated from the graph 
population. Either this is done in a constructor function or we would need some 
obscure tricks with the class kwargs. This way, there's a separation of 
concerns - the class wraps *one* exception, and the function creates a bunch 
and links them together as needed.

--

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



[issue18468] re.group() should never return a bytearray

2013-07-18 Thread Ezio Melotti

Ezio Melotti added the comment:

 match/search are supposed to work with str or bytes and
 they return str/bytes accordingly.

s/they return/calling m.group() returns/

--

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



[issue17911] Extracting tracebacks does too much work

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 When it comes to deferral, we could wrap each line in a different
 class than tuple, but this constitutes a public API change (and this
 is a *very* widely used library). Even changing to a namedtuple
 would cause a lot of grief, since we'd break lots of doctests, and
 subclassing tuple is a lot of effort for little benefit. If we only
 do it for the deferred usage, it would only be inconsistent. I
 suppose we could have a completely separate way of doing things for
 ExceptionSummary, but again, inconsistent, and I think if one
 extract_xxx method provides the functionality, users would expect it
 to be available in the others.

YMMV, but I think we should go for inconsistency here. The other APIs
in the traceback module are low-level and clearly limited by the type
of objects they return.

This feature request is a good opportunity to design something a little
more future-proof. I'd love to know what other developers/contributors
think here.

--

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



[issue18451] Omit test files in devinabox coverage run

2013-07-18 Thread Brett Cannon

Brett Cannon added the comment:

The problem is confusing new contributors.

Why wasn't this test run?
Because you're not on OS X.
Why wasn't this run?
I didn't have internet at the time.

It's noise that's unnecessary. People should be focusing on the coverage of the 
modules in the stdlib and not the tests themselves. Plus the process takes so 
darn long already I don't think it's worth the time to waste on covering the 
tests as well.

--

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



[issue16611] multiple problems with Cookie.py

2013-07-18 Thread John Dennis

John Dennis added the comment:

I think your basic approach is fine and it's O.K. to break backwards 
compatibility. I'm not sure anyone was using the httponly and secure flags in 
the past because it was so broken, the logic was completely contradictory, so 
backwards compatibility should not trump fixing obviously broken logic.

I didn't review your patch carefully, just a really quick glance. The one thing 
that did pop out was compiling the static regexp every time the function is 
called. Why not make it a module or class object and compile once at load time?

--

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



[issue18451] Omit test files in devinabox coverage run

2013-07-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The problem is confusing new contributors.
 
 Why wasn't this test run?
 Because you're not on OS X.
 Why wasn't this run?
 I didn't have internet at the time.

Well, you're trying to fix a symptom, rather than the underlying cause.
And the concept of skipped tests is quite basic, it shouldn't be very
hard to grasp.

 It's noise that's unnecessary. People should be focusing on the
 coverage of the modules in the stdlib and not the tests themselves.
 Plus the process takes so darn long already I don't think it's worth
 the time to waste on covering the tests as well.

Whether or not the report includes the test files shouldn't impact the
test runtime.

--

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



[issue18491] Add exe wrapper functionality to Windows launcher

2013-07-18 Thread Paul Moore

New submission from Paul Moore:

Adds exe wrapper functionality to the Windows launcher. This is a preliminary 
patch, for comments - the code is there and works, but I need to add 
documentation (and maybe tests - are there any existing tests for the launcher?)

Also to be considered: should the launcher be bundled somewhere accessible to 
Python code (locating where the launcher has been installed is a non-trivial 
task) and supplementing that, should there be some sort of wrapper creation API 
in the standard library. The script wrapper functionality in distlib may be a 
good model for this, but may be too complex. I'd rather see this patch accepted 
without support code than see it deferred due to concerns about the 
quality/design of additional support code.

--
assignee: vinay.sajip
components: Windows
messages: 193300
nosy: pmoore, vinay.sajip
priority: normal
severity: normal
stage: patch review
status: open
title: Add exe wrapper functionality to Windows launcher
type: enhancement
versions: Python 3.4

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



[issue18491] Add exe wrapper functionality to Windows launcher

2013-07-18 Thread Paul Moore

Changes by Paul Moore p.f.mo...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file30966/launcher_wrapper.patch

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



[issue18491] Add exe wrapper functionality to Windows launcher

2013-07-18 Thread Paul Moore

Changes by Paul Moore p.f.mo...@gmail.com:


--
nosy: +tim.golden

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

I cannot reproduce the issue on Ubuntu.
As for the second exception I think it's safe to just do:

- raise URLError('ftp error: %d' % reason) from reason
+ raise URLError('ftp error: %s' % reason) from reason

(will commit that later)

--

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



[issue18468] re.group() should never return a bytearray

2013-07-18 Thread Guido van Rossum

Guido van Rossum added the comment:

 Ezio Melotti added the comment:
[...]
 IIUC the advantage of changing the behavior is that it won't keep the target 
 string alive anymore, but on the other hand is not backward compatible and 
 makes things more difficult for people who want the same type back.

Everyone seems to be afraid of backward compatibility here. I will
take full responsibility, so let's just discuss what's the better API,
regardless of what we did (and in 99% of the cases it's the same
anyway).

People who want the same type back -- there is no evidence that
anyone wants this. People who want a bytes object -- this is
definitely a valid use case.

 If people always want bytes back regardless of the input, they can convert 
 the input or output to bytes explicitly.

But this requires an extra copy if the input is a bytearray. I suspect
this might be the most commonly used non-bytes non-str target in
Python 3 programs, and we are striving to support bytearray as input
in as many places as possible where plain bytes is accepted. But
generally getting bytearray as output requires a different API, e.g.
recv_into().

I think a very reasonable general rule is that for functions that take
either str or bytes and adjust their output to the input type, if
their input is one of the bytes alternatives (bytearray, memoryview,
array.array('b'), maybe others) the output is always a bytes object.

The reason is that while the buffer API makes it easy to access the
underlying bytes from C, it doesn't give you a way to create a new
object of the same type (except by slicing, which doesn't always
apply, e.g. os.listdir()). So for creating return values that match a
memoryview (or bytearray, etc.) input, the only reasonable thing is to
return a bytes object.

(FWIW os.listdir() violates this too -- os.listdir(b'.') returns a
list of bytes objects, while os.listdir(bytearray(b'.')) returns a
list of str objects. This seems caused by revesed logic -- it probably
tests if the type is bytes rather than if the type isn't str for
the output type, even though it does the right thing with the
input...)

--

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Rock Lee

Rock Lee added the comment:

Bug in urllib/request.py.
format string formatted error type variable 

 2373 except ftplib.error_perm as reason:
 2374   raise URLError('ftp error: %d' % reason) from reason

variable reason here is a instance of class ftplib.error_perm.
We need to passed in a integer object. 

Patch supplied.

--
keywords: +patch
nosy: +rock
Added file: 
http://bugs.python.org/file30967/urllib-request-format-type-bug.patch

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Rock Lee

Rock Lee added the comment:

Fixed like this:

raise URLError('ftp error: %d' % int(str(reason)[:3])) from reason

I think this is the original author's intention. 

Actually, need to fix two places in urllib/request.py

--

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

That's not safe as a misbehaving FTP server might not send a response code at 
all (highly unlikely but still...).
Furthermore having the complete server response (response code + accompaining 
message) is a lot more helpful.

--

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



[issue17214] http.client.HTTPConnection.putrequest encode error

2013-07-18 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I have no problem if this ticket is classified as won't fix.

I am writing this for the confused souls who want to use urllib to access url 
containing non-ascii characters:

import urllib.request
from urllib.parse import quote
url = 
http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc;

req = urllib.request.Request(url)
try:
req.selector.encode('ascii')
except UnicodeEncodeError:
req.selector = quote(req.selector)
response = urllib.request.urlopen(req, timeout=30)
the_page = response.read().decode('utf-8')
print(the_page)

--

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Rock Lee

Rock Lee added the comment:

yes, the malformed server could do evil things.  If we need to cover this 
situation, we need to some extra fixes in this file. 

Maybe the exception message look like this is the better one ?
   ftplib.error_perm: 550 Failed to change directory

--

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

I think raise URLError('ftp error: %s' % reason) from reason is just fine.

--

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-07-18 Thread Rock Lee

Rock Lee added the comment:

Yes, the simplest fix is just replace '%d' to '%s'.

Line 2362 and 2374 all need to modify.

--

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



[issue18492] Add test.support.regrtest_run flag, simplify support.requires

2013-07-18 Thread Zachary Ware

New submission from Zachary Ware:

Here's a patch to implement the idea I posted in issue18258, msg193242.  The 
patch also removes usage of support.use_resources = ['resource'] from the 
test package since it is no longer needed.

(No test_main - unittest.main conversions are done in this patch; the modules 
changed that still us. test_main are either covered by another issue or are 
more complex than a simple remove-and-replace conversion, and so I didn't want 
to lump them into this patch)

--
components: Tests
files: regrtest_run.diff
keywords: patch
messages: 193310
nosy: ezio.melotti, r.david.murray, serhiy.storchaka, zach.ware
priority: normal
severity: normal
status: open
title: Add test.support.regrtest_run flag, simplify support.requires
type: enhancement
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30968/regrtest_run.diff

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



[issue18258] Fix test discovery for test_codecmaps*.py

2013-07-18 Thread Zachary Ware

Zachary Ware added the comment:

Done, issue18492.

I'll submit and updated patch here when (if :)) that one is applied.

I'm also looking into adding resource handling to unittest itself and it is 
going pretty well; I hope to have a patch ready for review for that soon.

--

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



[issue17214] http.client.HTTPConnection.putrequest encode error

2013-07-18 Thread Lars Ivarsson

Lars Ivarsson added the comment:

The problem isn't the original requested url, as it is legit. The problem 
appears after the 302 redirect when a new (malformed) url is received from the 
server. There need to be some kind of check of the validity of that second url. 
And, preferably, an URLError returned if something is wrong.

--

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



[issue18493] make profile-opt fails with pre-existing python2.7 in path

2013-07-18 Thread Claudio Freire

New submission from Claudio Freire:

When building with --enable-shared in an environment that already has a 
python2.7 (and I'd expect the same to happen to 3.x), make profile-opt fails 
because it attempts to load the existing libpython instead of the just-built 
one.

run_profile_task should use RUNSHARED. In fact, it builds fine if $(RUNSHARED) 
is added to that line.

Patch inline below, for 2.7.5:

--- Makefile.pre.in.bk  2013-07-18 17:46:28.671773378 +
+++ Makefile.pre.in 2013-07-18 17:46:47.759806100 +
@@ -420,7 +420,7 @@
 
 run_profile_task:
: # FIXME: can't run for a cross build
-   ./$(BUILDPYTHON) $(PROFILE_TASK)
+   $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
 
 build_all_use_profile:
$(MAKE) all CFLAGS=$(CFLAGS) -fprofile-use

--
components: Build
messages: 193313
nosy: Claudio.Freire
priority: normal
severity: normal
status: open
title: make profile-opt fails with pre-existing python2.7 in path
versions: Python 2.7

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



[issue18492] Add test.support.regrtest_run flag, simplify support.requires

2013-07-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't think we should accept anything if not running under regrtest, We can 
unintentionally run a testfile in which some tests consume a lot of resources. 
Also we need in skipping this tests for the test testing. I think it will be 
better just add a support of the -u option to discovery command line interface.

--

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



[issue18494] PyType_GenericSet/GetDict functions misnamed in docs?

2013-07-18 Thread Wolf Ihlenfeldt

New submission from Wolf Ihlenfeldt:

Are the names of functions PyType_GenericSetDict and -GetDict correctly 
documented (for 3.3.2), or should they be documented as 
PyObject_GenericGet/SetDict instead? The PyType-prefixed names are out of place 
in the section, and functions of these names not in the source. The 
PyObject_-variants are present.

--
assignee: docs@python
components: Documentation
messages: 193315
nosy: Wolf.Ihlenfeldt, docs@python
priority: normal
severity: normal
status: open
title: PyType_GenericSet/GetDict functions misnamed in docs?
versions: Python 3.3

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



[issue18491] Add exe wrapper functionality to Windows launcher

2013-07-18 Thread Jeremy Kloth

Changes by Jeremy Kloth jeremy.kloth+python-trac...@gmail.com:


--
nosy: +jkloth

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-18 Thread Stefan Behnel

Stefan Behnel added the comment:

This test from lxml's ElementTree test suite crashes for me now when run 
against (c)ElementTree:

def test_parser_target_error_in_start(self):
assertEqual = self.assertEqual

events = []
class Target(object):
def start(self, tag, attrib):
events.append(start)
assertEqual(TAG, tag)
raise ValueError(TEST)
def end(self, tag):
events.append(end)
assertEqual(TAG, tag)
def close(self):
return DONE

parser = ET.XMLParser(target=Target())

try:
parser.feed(TAG/)
except ValueError:
self.assertTrue('TEST' in str(sys.exc_info()[1]))
else:
self.assertTrue(False)
self.assertTrue(start in events)

Python/ceval.c:1210: PyEval_EvalFrameEx: Assertion `!PyErr_Occurred()' failed.

(note: this is not the exact code, I removed a couple of conditions that are 
not used by ET)

--
nosy: +scoder

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



[issue16611] multiple problems with Cookie.py

2013-07-18 Thread Julien Phalip

Julien Phalip added the comment:

Thank you for the feedback. I've updated the patch to compile the regular 
expression at load time.

--
Added file: http://bugs.python.org/file30969/cookies-httponly-secure-2.diff

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



[issue18496] mingw: setup exclude termios module

2013-07-18 Thread Roumen Petrov

New submission from Roumen Petrov:

Split of issue3871 - part for build of core modules.

--
components: Build
files: 0008-MINGW-setup-exclude-termios-module.patch
keywords: patch
messages: 193319
nosy: rpetrov
priority: normal
severity: normal
status: open
title: mingw: setup exclude termios module
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file30971/0008-MINGW-setup-exclude-termios-module.patch

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



[issue18497] mingw: setup _multiprocessing module

2013-07-18 Thread Roumen Petrov

New submission from Roumen Petrov:

Split of issue3871 - build core modules.

--
components: Build
files: 0009-MINGW-setup-_multiprocessing-module.patch
keywords: patch
messages: 193320
nosy: rpetrov
priority: normal
severity: normal
status: open
title: mingw: setup _multiprocessing module
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file30972/0009-MINGW-setup-_multiprocessing-module.patch

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



[issue18498] mingw: setup select module

2013-07-18 Thread Roumen Petrov

New submission from Roumen Petrov:

Split of issue3871 - build core modules.

--
components: Build
files: 0010-MINGW-setup-select-module.patch
keywords: patch
messages: 193321
nosy: rpetrov
priority: normal
severity: normal
status: open
title: mingw: setup select module
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file30973/0010-MINGW-setup-select-module.patch

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



[issue18495] mingw: ignore main program for frozen scripts

2013-07-18 Thread Roumen Petrov

New submission from Roumen Petrov:

Split of issue3871 - part for build of core modules.

--
components: Build
files: 0007-MINGW-ignore-main-program-for-frozen-scripts.patch
keywords: patch
messages: 193318
nosy: rpetrov
priority: normal
severity: normal
status: open
title: mingw: ignore main program for frozen scripts
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file30970/0007-MINGW-ignore-main-program-for-frozen-scripts.patch

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



[issue18499] mingw: setup _ctypes module with system libffi

2013-07-18 Thread Roumen Petrov

New submission from Roumen Petrov:

enhancement of issue3871 ( build core modules ).
Part of issue 3871 is python libffi source for gnu assembler on 32 windows 
platform. The functionality is same as inlined assembled for MSC. Note python 
specific libffi customization is not in mainstream libffi source.

This patch adds build with system libffi.

You you like to use customized libffi then please extract from previous 'all in 
one' patch.

--
components: Build
files: 0011-MINGW-setup-_ctypes-module-with-system-libffi.patch
keywords: patch
messages: 193322
nosy: rpetrov
priority: normal
severity: normal
status: open
title: mingw: setup _ctypes module with system libffi
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file30974/0011-MINGW-setup-_ctypes-module-with-system-libffi.patch

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



[issue18500] mingw: defect winsock2 and setup _socket module

2013-07-18 Thread Roumen Petrov

New submission from Roumen Petrov:

Split of issue3871 (build core modules) - improved winsock detection. Requires 
NT 5.1+ (wxp).

Note if you like python winsock for w2k then please extract from old 'all in 
one' patch.

--
components: Build
files: 0012-MINGW-defect-winsock2-and-setup-_socket-module.patch
keywords: patch
messages: 193323
nosy: rpetrov
priority: normal
severity: normal
status: open
title: mingw: defect winsock2 and setup _socket module
type: enhancement
versions: Python 3.4
Added file: 
http://bugs.python.org/file30975/0012-MINGW-defect-winsock2-and-setup-_socket-module.patch

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ec0e9347dd4 by Victor Stinner in branch 'default':
Issue #18408: Fix _elementtree.c, don't call Python function from an expat
http://hg.python.org/cpython/rev/6ec0e9347dd4

--

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



[issue18501] _elementtree.c calls Python callbacks while a Python exception is set

2013-07-18 Thread STINNER Victor

New submission from STINNER Victor:

The ElementTree module allows to write a XML parser using Python callbacks. The 
module relies on the expat library which is implemented in C. Expat calls these 
Python callbacks, but ElementTree does not check if a Python exception was 
raised or not.

Example 1:
---
import unittest
from xml.etree import ElementTree as ET

class Target(object):
def start(self, tag, attrib):
print(start)
raise ValueError(raise start)

def end(self, tag):
print(end)
raise ValueError(raise end)

def close(self):
print(close)
raise ValueError(raise close)

parser = ET.XMLParser(target=Target())
parser.feed(roottest //root)
---

Output with Python 3.3:
---
start
startendendTraceback (most recent call last):
  File x.py, line 18, in module
parser.feed(roottest //root)
  File x.py, line 10, in end
print(end)
  File x.py, line 10, in end
print(end)
  File x.py, line 6, in start
print(start)
  File x.py, line 7, in start
raise ValueError(raise start)
ValueError: raise start
---

start() was called twice, as end() method, even if the first start() method 
raised an exception.

The traceback is strange: it looks like end() was called by start(), which is 
wrong.


Example 2:
---
import unittest
from xml.etree import ElementTree as ET

class Target(object):
def start(self, tag, attrib):
raise ValueError(raise start)

def end(self, tag):
raise ValueError(raise end)

def close(self):
raise ValueError(raise close)

parser = ET.XMLParser(target=Target())
parser.feed(roottest //root)
---

Output with Python 3.3:
---
Traceback (most recent call last):
  File x.py, line 15, in module
parser.feed(roottest //root)
  File x.py, line 9, in end
raise ValueError(raise end)
ValueError: raise end
---

end() was called even if start() already failed. The exception which was set by 
start has been replaced by end() exception.

In my opinion, it's not a good thing to call PyEval_EvalFrameEx() and similar 
functions when a Python exception is set, because it behaves badly (ex: 
print(end) in Example 1 raises an exception... which is wrong, the traceback 
is also corrupted) and may replaces the old exception with a new exception (ex: 
end replaces started).

--
messages: 193325
nosy: haypo
priority: normal
severity: normal
status: open
title: _elementtree.c calls Python callbacks while a Python exception is set
versions: Python 3.4

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



[issue18501] _elementtree.c calls Python callbacks while a Python exception is set

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

For the issue #18408, I added assertions in PyEval_EvalFrameEx() and similar 
functions to exit with an assertion error in debug mode if these functions are 
called with an exception set:

New changeset 48a869a39e2d by Victor Stinner in branch 'default':
Issue #18408: PyEval_EvalFrameEx() and PyEval_CallObjectWithKeywords() now fail
http://hg.python.org/cpython/rev/48a869a39e2d

New changeset 5bd9db528aed by Victor Stinner in branch 'default':
Issue #18408: PyObject_Str(), PyObject_Repr() and type_call() now fail with an
http://hg.python.org/cpython/rev/5bd9db528aed

lxml test suite failed with an C assertion error because of these changes. I 
fixed the issue with the following change:

New changeset 6ec0e9347dd4 by Victor Stinner in branch 'default':
Issue #18408: Fix _elementtree.c, don't call Python function from an expat
http://hg.python.org/cpython/rev/6ec0e9347dd4

Instead of having to check if an exception is set in each Python callback, it 
would be better to stop the XML parser. Modules/pyexpat.c calls 
flag_error(self); XML_SetCharacterDataHandler(self-itself, 
noop_character_data_handler); on error:

/* This handler is used when an error has been detected, in the hope
   that actual parsing can be terminated early.  This will only help
   if an external entity reference is encountered. */
static int
error_external_entity_ref_handler(XML_Parser parser,
  const XML_Char *context,
  const XML_Char *base,
  const XML_Char *systemId,
  const XML_Char *publicId)
{
return 0;
}

/* Dummy character data handler used when an error (exception) has
   been detected, and the actual parsing can be terminated early.
   This is needed since character data handler can't be safely removed
   from within the character data handler, but can be replaced.  It is
   used only from the character data handler trampoline, and must be
   used right after `flag_error()` is called. */
static void
noop_character_data_handler(void *userData, const XML_Char *data, int len)
{
/* Do nothing. */
}

static void
flag_error(xmlparseobject *self)
{
clear_handlers(self, 0);
XML_SetExternalEntityRefHandler(self-itself,
error_external_entity_ref_handler);
}

--

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



[issue18501] _elementtree.c calls Python callbacks while a Python exception is set

2013-07-18 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
nosy: +christian.heimes

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

 This test from lxml's ElementTree test suite crashes for me now when run 
 against (c)ElementTree: (...)

Thanks for the quick report! Are you testing automatically lxml with the Python 
HEAD?

The issue should be fixed by the changeset 6ec0e9347dd4. I also opened the 
issue #18501 to discuss how ElementTree should handle Python exceptions.

--

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



[issue18501] _elementtree.c calls Python callbacks while a Python exception is set

2013-07-18 Thread Fred L. Drake, Jr.

Changes by Fred L. Drake, Jr. fdr...@gmail.com:


--
nosy: +fdrake

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



[issue17349] wsgiref.simple_server.demo_app is not PEP-3333 compatible

2013-07-18 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage:  - patch review

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5a6cdc0d7de1 by Victor Stinner in branch 'default':
Issue #18501, #18408: Fix expat handlers in pyexpat, don't call Python
http://hg.python.org/cpython/rev/5a6cdc0d7de1

--

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



[issue18501] _elementtree.c calls Python callbacks while a Python exception is set

2013-07-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5a6cdc0d7de1 by Victor Stinner in branch 'default':
Issue #18501, #18408: Fix expat handlers in pyexpat, don't call Python
http://hg.python.org/cpython/rev/5a6cdc0d7de1

--
nosy: +python-dev

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



[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Daniel Holth

Daniel Holth added the comment:

Python 3 is supposed to make it easier to do Unicode correctly. str(bytes) does 
not. I felt strongly enough about that to write this patch.

With this feature my library can have control in a way that is much more 
practical than ensuring a particular flag has been passed to the interpreter.

It might make sense to modify the patch so str(bytes) can throw a regular 
exception instead of a warning while under the influence of the new flag. The 
reason being that the warning will be suppressed the second time around but for 
this use case you wouldn't want that.

--

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



[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

 Python 3 is supposed to make it easier to do Unicode correctly. str(bytes) 
 does not.

str(bytes) does not make sense, that's why an exception is raised when
the -bb command line option is used ;-)

--

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



[issue18502] CDLL does not use same paths as util.find_library

2013-07-18 Thread Steven Johnson

New submission from Steven Johnson:

CDLL does not use the same paths as find_library and thus you can *find* a 
library, but you can't necessarily use it.

In my case, I had SDL2 in /usr/local/lib. find_library correctly gets
the name, but does not return the path. CDLL apparently does not search
/usr/local/lib and fails.

Python 3.4.0a0 (default:5a6cdc0d7de1, Jul 18 2013, 17:55:27) 
[GCC 4.7.3] on linux
Type help, copyright, credits or license for more information.
 from ctypes import *
 import ctypes.util
 ctypes.util.find_library(SDL2)
'libSDL2-2.0.so.0'
 CDLL(_)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/steven/Programming/cpython/Lib/ctypes/__init__.py, line 351, in 
__init__
self._handle = _dlopen(self._name, mode)
OSError: libSDL2-2.0.so.0: cannot open shared object file: No such file or 
directory
 CDLL(/usr/local/lib/libSDL2.so)
CDLL '/usr/local/lib/libSDL2.so', handle 22f89c0 at 7fc966da5ae8

--
components: ctypes
messages: 193332
nosy: shjohnson.pi
priority: normal
severity: normal
status: open
title: CDLL does not use same paths as util.find_library
type: behavior
versions: Python 3.4

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



[issue17911] Extracting tracebacks does too much work

2013-07-18 Thread Nick Coghlan

Nick Coghlan added the comment:

For dis, we introduced a new rich bytecode introspection API. Ditto for
inspect.Signature. I think it makes sense to treat this as a completely new
traceback introspection API and ignore the low level details of the legacy
API.

--

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



[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-07-18 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

ssl-socket-readwrite-after-close.diff: instead of testing not self._sslobj, I 
would prefer an explicit self._sslobj is None.

--
nosy: +haypo

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



[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

The check should be moved into the _checkClosed() method. Example:

def _checkClosed(self):
io.RawIOBase._checkClosed(self)
if self._sslobj is None:
raise ValueError(I/O operation on closed SSL socket)

--

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



[issue9177] ssl.read/write on closed socket raises AttributeError

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

Oops, remove io.RawIOBase._checkClosed(self) from my example (I read 
socket.py at the same time, SSLSocket inherits from socket, not from RawIOBase).

--

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

I created the issue #18488: sqlite: finalize() method of user function may be 
called with an exception set if a call to step() method failed.

--

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



[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

See also isue #18501, similar issue in ElementTree.

I created the issue while working on the issue #18408.

--

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



[issue18501] _elementtree.c calls Python callbacks while a Python exception is set

2013-07-18 Thread STINNER Victor

STINNER Victor added the comment:

See also the issue #18488, similar issue in sqlite.

--

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



[issue18042] Provide enum.unique class decorator

2013-07-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2079a517193b by Ethan Furman in branch 'default':
closes issue18042 -- a `unique` decorator is added to enum.py
http://hg.python.org/cpython/rev/2079a517193b

--
nosy: +python-dev
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue18491] Add exe wrapper functionality to Windows launcher

2013-07-18 Thread Vinay Sajip

Vinay Sajip added the comment:

My initial comments - seems like a reasonable approach. I think you may need to 
consider -script.pyw for the GUI case. I will look into it in more detail.

I'll add Mark to the nosy list, as the launcher was originally his idea and he 
might have a view.

What support code are you referring to?

Re. tests - there are tests, see the repo on BitBucket:

https://bitbucket.org/pypa/pylauncher/src/tip/tests.py?at=default

There are no tests in the Python suite; because of the specialised nature of 
the launcher, to do proper tests you need 2.x and 3.x installed on the test 
machine, preferably both 32- and 64-bit variants. This doesn't match our 
buildbot configurations.

--
nosy: +mhammond

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



[issue18491] Add exe wrapper functionality to Windows launcher

2013-07-18 Thread Mark Hammond

Mark Hammond added the comment:

I don't understand the motivation for this - how will it be used in practice?

--

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



[issue18264] enum.IntEnum is not compatible with JSON serialisation

2013-07-18 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


--
nosy: +cvrebert

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



[issue18491] Add exe wrapper functionality to Windows launcher

2013-07-18 Thread Vinay Sajip

Vinay Sajip added the comment:

 I don't understand the motivation for this - how will it be used in practice?

It allows the launcher to do double duty as an executable launcher for scripts 
which works in the same way as executable launchers in setuptools-installed 
scripts.

Its use in this way is redundant if the launcher is actually installed. 
However, if the launcher isn't installed, it's considered the only fool-proof 
way of invoking Python scripts on Windows.

This patch is a consequence of discussions ongoing on distutils-sig about 
bundling setuptools and pip in Python.

In practice, a Python script 'foo' in a distribution, which would be called 
just plain 'foo' on Unix and have a Python shebang line, would be named 
'foo-script.py' with a copy of the launcher as 'foo.exe' alongside, which 
invokes the Python script when run. A GUI script would be called 
'foo-script.pyw' and have the GUI version of the launcher in 'foo.exe'.

--

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



[issue18491] Add exe wrapper functionality to Windows launcher

2013-07-18 Thread Mark Hammond

Mark Hammond added the comment:

Obviously I'm missing a little context, but it seems a little wrong for the 
same launcher to be doing this double-duty.  It seems we only want to use the 
launcher in this way as it already has some of the interesting code we need - 
but the vast majority of users aren't going to want to have it behave this way 
implicitly (ie, when they start what they consider the launcher, they aren't 
going to expect this magic.  Conversely, when someone executes foo, they are 
going to be expecting exactly 1 thing to happen and that isn't do what py.exe 
with no args does)

So maybe this could be behind a #define, and have another .exe built from the 
same sources?  One exe sticks with the launcher semantics (ie, never looks for 
foo-script.py), and the other sticks with the wrapper semantics (ie, terminates 
with an error if foo-script.py can't be found)

All that said though, I'm not involved in the distutils discussions and 
acknowledge the general requirements as real, so do whatever you need to do :)

--

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



[issue18480] _elementtree: missing PyType_Ready call

2013-07-18 Thread Eli Bendersky

Eli Bendersky added the comment:

LGTM, thanks.

--

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



[issue17214] http.client.HTTPConnection.putrequest encode error

2013-07-18 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Lars, I see.

For the uninitiated, the issue is the original url (containing only ascii 
character) redirects to the url containing non-ascii characters which upsets 
urllib.

To handle that situation, you can do something like this:
-
import urllib.request
from urllib.parse import quote
url = http://www.libon.it/libon/search/isbn/3499155443;
req = urllib.request.Request(url)
req.selector = urllib.parse.quote(req.selector)
response = urllib.request.urlopen(req, timeout=30)
the_page = response.read().decode('utf-8')
print(the_page)
-

I admit it that this code is clunky and not pythonic.

I also believe in python standard library, we should have a module to access 
url containing non-ascii character in an easy manner.

At the very least, maybe we can give proper error message. Something like this 
would be nice:

The url is not valid and contains non-ascii character: 
http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc.
 This url is redirected from this url: 
http://www.libon.it/libon/search/isbn/3499155443;

Because users can be confused. They thought they already gave 
only-ascii-characters url (http://www.libon.it/libon/search/isbn/3499155443) to 
urllib, but why did they get encoding error?

What do you say, Christian?

--

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