Re: Putting Unicode characters in JSON

2018-03-22 Thread Steven D'Aprano
On Fri, 23 Mar 2018 12:05:34 +1100, Chris Angelico wrote:

> Latin-1 is not "arbitrary bytes". It is a very specific encoding that
> cannot decode every possible byte value.

Yes it can.

py> blob = bytes(range(256))
py> len(blob)
256
py> blob[45:55]
b'-./0123456'
py> s = blob.decode('latin1')
py> len(s)
256
py> s[45:55]
'-./0123456'



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


PyQt4 QWebView cant load google maps markers

2018-03-22 Thread Xristos Xristoou

I want to create a simple python app using pyqt,QWebView and google maps with 
markers. 

The problem is that,the markers does not load inside the QWebView, as you can 
see they load just fine in the browser. 


here the simple code : 

 import sys 
 from PyQt4.QtCore import * 
 from PyQt4.QtGui import * 
 from PyQt4.QtWebKit import * 
 import os 
 app = QApplication(sys.argv) 
 web_view= dialog.findChild(QWebView,"webView") 
 
google='https://www.google.gr/maps/place/Granite+Mountain+Hotshots+Memorial+State+Park/@34.1749572,-112.850308,12.78z/data=!4m13!1m7!3m6!1s0x872b08ebcb4c186b:0x423927b17fc1cd71!2zzpHPgc65zrbPjM69zrEsIM6Xzr3Pic68zq3Ovc61z4IgzqDOv867zrnPhM61zq_Otc-C!3b1!8m2!3d34.0489281!4d-111.0937311!3m4!1s0x80d330577faee965:0x66d75aef24890ae1!8m2!3d34.2032843!4d-112.7746582?hl=el'
 
 web_view2.load(QUrl(google)) 
 web_view2.show() 
 sys.exit(app.exec_()) 


error message : 
right click and select Inspect, then go to console and observe the messages 
console I take this error : 


TypeError: 'undefined' is not a function (evaluating 'this.D.bind(this)') 
marker.js:58 




Any idea how to can fix that ? 
I need to add more settings to QWebView to work google maps with markers ?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23434] support encoded filename in Content-Disposition for HTTP in cgi.FieldStorage

2018-03-22 Thread R. David Murray

R. David Murray  added the comment:

I haven't read the http rfcs, but my understanding is that they follow the MIME 
standards, and the email library already has code to do proper parsing and 
decoding of encoded filenames in Content-Disposition headers.  It should be 
possible to call that code for this use case (the http libraries already depend 
on the email libraries, although I'm not sure if cgi itself does currently).  
There may be additional considerations involved in fully supporting the http 
RFCs, but to determine that someone will need to read both and understand them, 
which is not a small undertaking :)

In the meantime, I'm pretty sure that using the existing mime header parsing 
code in the email library (see email.headerregistry) will provide better 
parsing than the only-handles-simple-cases heuristic in your PR.  Granted, I 
don't think you have to deal with multi-part headers in http, but I vaguely 
remember that there are other subtleties not handled by a simple split on '.

--

___
Python tracker 

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



[issue33125] Windows 10 ARM64 platform support

2018-03-22 Thread Steven Noonan

Steven Noonan  added the comment:

Oh, another change I had to make was remove all the BaseAddress elements in the 
Link sections. The linker complains if these are used (the lower 4GB of memory 
are apparently reserved for the x86 emulation). Also, from what I was told by 
someone over at Microsoft, the BaseAddress options don't do anything useful on 
modern Windows versions unless you build with -fixed as well, because 
everything gets relocated anyway.

--

___
Python tracker 

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



Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 11:39 AM, Steven D'Aprano
 wrote:
> On Fri, 23 Mar 2018 11:08:56 +1100, Chris Angelico wrote:
>> Okay. Give me a good reason for the database itself to be locked to
>> Latin-1. Make sure you explain how potentially saving the occasional
>> byte of storage (compared to UTF-8) justifies limiting the available
>> character set to the ones that happen to be in Latin-1, yet it's
>> essential to NOT limit the character set to ASCII.
>
> I'll better than that, I'll give multiple good reasons to use Latin-1.
>
> It's company policy to only use Latin-1, because the CEO was once
> employed by the Unicode Consortium, and fired in disgrace after
> embezzling funds, and ever since then he has refused to use Unicode.

You clearly can't afford to quit your job, so I won't mention that
possibility. (Oops too late.) But a CEO is not God, and you *can*
either dispute or subvert stupid orders. I don't consider this a
*good* reason. Maybe a reason, but not a good one.

> Compatibility with other databases, systems or tools that require Latin-1.

Change them one at a time. When you have to pass data to something
that has to receive Latin-1, you encode it to Latin-1. The database
can still store UTF-8. Leaving it at Latin-1 is not "good reason for
using Latin-1", so much as "we haven't gotten around to changing it
yet".

> The database has to send information to embedded devices that don't
> include a full Unicode implementation, but do support Latin-1.

Okay, that's a valid reason, if an incredibly rare one. You have to
specifically WANT an encoding error if you try to store something
that, later on, will cause problems. It's like asking for a 32-bit
signed integer type in Python, because you're using it for something
where it's eventually going to be sent to something that can't use
larger numbers. Not something that wants a core feature, usually.

> The data doesn't actually represent text, but Python 2 style byte-
> strings, and Latin-1 is just a convenient, easy way to get that that
> ensures ASCII bytes look like ASCII characters.

The OP is talking about JSON. Reason makes no sense in that context.
And if it really is a byte string, why store it as a Latin-1 string?
Store it as the type BLOB instead. Latin-1 is not "arbitrary bytes".
It is a very specific encoding that cannot decode every possible byte
value. Using Latin-1 to store arbitrary bytes is just as wrong as
using ASCII to store eight-bit data.

So, you've given me one possible reason that is EXTREMELY situational
and, even there, could be handled differently. And it's only valid
when you're working with something that supports more than ASCII and
no more than Latin-1, and moreover, you have the need for non-ASCII
characters. (Otherwise, just use ASCII, which you can declare as UTF-8
if you wish.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33125] Windows 10 ARM64 platform support

2018-03-22 Thread Steven Noonan

New submission from Steven Noonan :

The Windows 10 ARM64 release is out along with a bunch of ARM64 devices. This 
version of Windows has full support for building native Win32 applications 
(this isn't just some rehash of Windows RT). It also can run x86 (but not 
x86_64) apps under a transparent emulation layer.

I would like to see a native build of Python on Windows 10 ARM64.

I did some very basic work to get it compiling (add 10.0.16299.0 as 
DefaultWindowsSDKVersion, add WindowsSDKDesktopARM64Support property). But 
there's still a lot missing: ssl, tk, and ctypes don't build.

ssl/ctypes have some assembly that needs writing/porting.

tk has some kind of build failure with the newer Windows SDK: 
https://core.tcl.tk/tk/tktview?name=3d34589aa0

--
components: Windows
messages: 314295
nosy: Steven Noonan, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows 10 ARM64 platform support
type: enhancement
versions: Python 3.6

___
Python tracker 

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



Re: Putting Unicode characters in JSON

2018-03-22 Thread Steven D'Aprano
On Fri, 23 Mar 2018 11:08:56 +1100, Chris Angelico wrote:

> On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano
>  wrote:
>> On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote:
>>
 I was reading though, that JSON files must be encoded with UTF-8.  So
 should I be doing string.decode('latin-1').encode('utf-8')?  Or does
 the json module do that for me when I give it a unicode object?
>>>
>>> Reconfigure your MySQL database to use UTF-8. There is no reason to
>>> use Latin-1 in the database.
>>
>> You don't know that. You don't know what technical, compatibility,
>> policy or historical constraints are on the database.
> 
> Okay. Give me a good reason for the database itself to be locked to
> Latin-1. Make sure you explain how potentially saving the occasional
> byte of storage (compared to UTF-8) justifies limiting the available
> character set to the ones that happen to be in Latin-1, yet it's
> essential to NOT limit the character set to ASCII.

I'll better than that, I'll give multiple good reasons to use Latin-1.

It's company policy to only use Latin-1, because the CEO was once 
employed by the Unicode Consortium, and fired in disgrace after 
embezzling funds, and ever since then he has refused to use Unicode.

Compatibility with other databases, systems or tools that require Latin-1.

The database has to send information to embedded devices that don't 
include a full Unicode implementation, but do support Latin-1.

The data doesn't actually represent text, but Python 2 style byte-
strings, and Latin-1 is just a convenient, easy way to get that that 
ensures ASCII bytes look like ASCII characters.


>>> If that isn't an option, make sure your JSON files are pure ASCII,
>>> which is the common subset of UTF-8 and Latin-1.
>>
>> And that's utterly unnecessary, since any character which can be stored
>> in the Latin-1 MySQL database can be stored in the Unicode JSON.
>>
>>
> Irrelevant; if you fetch eight-bit data out of the database, it isn't
> going to be a valid JSON file unless (1) it's really ASCII, like I
> suggest; (2) you re-encode it to UTF-8; or (3) it was actually UTF-8 all
> along, despite being declared as Latin-1.

As Tobiah pointed out in his question, he's fetching the data from the 
database, calling decode('latin-1'), and placing the resulting Unicode 
string into the JSON. There's no need to explicitly encode the Unicode 
string to a UTF-8 byte string, in fact it is the wrong thing to do since 
JSON doesn't support it:

# The right way is to use a Unicode string.

py> json.dumps("Hello ü")
'"Hello \\u00fc"'

# The wrong way is to encode to UTF-8 first.

py> json.dumps("Hello ü".encode('utf-8'))
Traceback (most recent call last):
  ...
TypeError: b'Hello \xc3\xbc' is not JSON serializable

(Results in Python 3 -- Python 2 may be doing something shonky.)



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 11:39 AM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> There is NOT always a good reason for a suboptimal configuration.
>
> True. Did anyone claim otherwise?
>
> What I saw Steven responding to was your claim that there is *never* a
> good reason to do it.
>
> To refute that, it's sufficient to show that good reason can exist in
> some cases. That's entirely compatible with a good reason not existing
> in other cases.
>

I'll concede that sometimes it's a lot of effort to fix misconfigured
databases. However, it's a form of technical debt, and when you start
investigating problems ("this isn't working because X is incompatible
with Y"), that's an indication that it's starting to cost you to
*maintain* the misconfiguration. Hence it's more likely to be worth
just paying off your technical debt and moving forward.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Putting Unicode characters in JSON

2018-03-22 Thread Thomas Jollans
On 22/03/18 20:46, Tobiah wrote:
> I was reading though, that JSON files must be encoded with UTF-8.  So
> should I be doing string.decode('latin-1').encode('utf-8')?  Or does
> the json module do that for me when I give it a unicode object?

Definitely not. In fact, that won't even work.

>>> import json
>>> s = 'déjà vu'.encode('latin1')
>>> s
b'd\xe9j\xe0 vu'
>>> json.dumps(s.decode('latin1').encode('utf8'))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
  File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
  File "/usr/lib/python3.6/json/encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'bytes' is not JSON serializable
>>>

You should make sure that either the file you're writing to is opened as
UTF-8 text, or the ensure_ascii parameter of dumps() or dump() is set to
True (the default) – and then write the data in ASCII or any
ASCII-compatible encoding (e.g. UTF-8).

Basically, the default behaviour of the json module means you don't
really have to worry about encodings at all once your original data is
in unicode strings.

-- Thomas
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Putting Unicode characters in JSON

2018-03-22 Thread Ben Finney
Chris Angelico  writes:

> There is NOT always a good reason for a suboptimal configuration.

True. Did anyone claim otherwise?

What I saw Steven responding to was your claim that there is *never* a
good reason to do it.

To refute that, it's sufficient to show that good reason can exist in
some cases. That's entirely compatible with a good reason not existing
in other cases.

-- 
 \ “Education is learning what you didn't even know you didn't |
  `\  know.” —Daniel J. Boorstin, historian, 1914–2004 |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 11:25 AM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano
>>  wrote:
>> > On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote:
>> >> Reconfigure your MySQL database to use UTF-8. There is no reason to
>> >> use Latin-1 in the database.
>> >
>> > You don't know that. You don't know what technical, compatibility,
>> > policy or historical constraints are on the database.
>>
>> Okay. Give me a good reason for the database itself to be locked to
>> Latin-1.
>
> That's a loaded question. If the database maintainers have a technical,
> compatibility, policy, or historical reason that constrains an existing
> database to a specific character set, then that is a good reason for
> them.
>
> Is it a good reason to create a new, independent database using Latin-1
> character set? No. But that's implicit in the fact it's an existing
> constraint, because it's an existing database.
>
> Is it a reason likely to convince you? Or convince me? No. But that's
> irrelevant because they don't have any need to convince us of the
> goodness of their reason to keep that encoding :-)

I happen to know that many deployments of MySQL have Latin-1 as the
default character set. Is *that* a good enough reason for you? Because
it isn't for me.

There is NOT always a good reason for a suboptimal configuration. Thus
I stand by my recommendation to reconfigure the database as first
option, with other options *following* it in my original email.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Putting Unicode characters in JSON

2018-03-22 Thread Ben Finney
Chris Angelico  writes:

> On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano
>  wrote:
> > On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote:
> >> Reconfigure your MySQL database to use UTF-8. There is no reason to
> >> use Latin-1 in the database.
> >
> > You don't know that. You don't know what technical, compatibility,
> > policy or historical constraints are on the database.
>
> Okay. Give me a good reason for the database itself to be locked to
> Latin-1.

That's a loaded question. If the database maintainers have a technical,
compatibility, policy, or historical reason that constrains an existing
database to a specific character set, then that is a good reason for
them.

Is it a good reason to create a new, independent database using Latin-1
character set? No. But that's implicit in the fact it's an existing
constraint, because it's an existing database.

Is it a reason likely to convince you? Or convince me? No. But that's
irrelevant because they don't have any need to convince us of the
goodness of their reason to keep that encoding :-)

-- 
 \   “Instead of having ‘answers’ on a math test, they should just |
  `\   call them ‘impressions’, and if you got a different |
_o__)   ‘impression’, so what, can't we all be brothers?” —Jack Handey |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano
 wrote:
> On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote:
>
>>> I was reading though, that JSON files must be encoded with UTF-8.  So
>>> should I be doing string.decode('latin-1').encode('utf-8')?  Or does
>>> the json module do that for me when I give it a unicode object?
>>
>> Reconfigure your MySQL database to use UTF-8. There is no reason to use
>> Latin-1 in the database.
>
> You don't know that. You don't know what technical, compatibility, policy
> or historical constraints are on the database.

Okay. Give me a good reason for the database itself to be locked to
Latin-1. Make sure you explain how potentially saving the occasional
byte of storage (compared to UTF-8) justifies limiting the available
character set to the ones that happen to be in Latin-1, yet it's
essential to NOT limit the character set to ASCII.

>> If that isn't an option, make sure your JSON files are pure ASCII, which
>> is the common subset of UTF-8 and Latin-1.
>
> And that's utterly unnecessary, since any character which can be stored
> in the Latin-1 MySQL database can be stored in the Unicode JSON.
>

Irrelevant; if you fetch eight-bit data out of the database, it isn't
going to be a valid JSON file unless (1) it's really ASCII, like I
suggest; (2) you re-encode it to UTF-8; or (3) it was actually UTF-8
all along, despite being declared as Latin-1.

Restricting JSON to ASCII is a very easy and common thing to do. It
just means that every non-ASCII character gets represented as a \u
escape sequence. In Python's JSON encoder, that's the ensure_ascii
parameter. Utterly unnecessary? How about standards-compliant and
entirely effective, unlike the re-encoding that means that the
database-stored blob is invalid JSON and must be re-encoded again on
the way out?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Putting Unicode characters in JSON

2018-03-22 Thread Steven D'Aprano
On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote:

>> I was reading though, that JSON files must be encoded with UTF-8.  So
>> should I be doing string.decode('latin-1').encode('utf-8')?  Or does
>> the json module do that for me when I give it a unicode object?
> 
> Reconfigure your MySQL database to use UTF-8. There is no reason to use
> Latin-1 in the database.

You don't know that. You don't know what technical, compatibility, policy 
or historical constraints are on the database.


> If that isn't an option, make sure your JSON files are pure ASCII, which
> is the common subset of UTF-8 and Latin-1.

And that's utterly unnecessary, since any character which can be stored 
in the Latin-1 MySQL database can be stored in the Unicode JSON.


-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-03-22 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
keywords: +patch
pull_requests: +5942
stage:  -> patch review

___
Python tracker 

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



[issue33119] python sys.argv argument parsing not clear

2018-03-22 Thread Brett Cannon

Change by Brett Cannon :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue33124] Lazy execution of module bytecode

2018-03-22 Thread Brett Cannon

Change by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue33124] Lazy execution of module bytecode

2018-03-22 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue33124] Lazy execution of module bytecode

2018-03-22 Thread Neil Schemenauer

Change by Neil Schemenauer :


--
keywords: +patch
pull_requests: +5941

___
Python tracker 

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



[issue33124] Lazy execution of module bytecode

2018-03-22 Thread Neil Schemenauer

New submission from Neil Schemenauer :

This is an experimental patch that implements lazy execution of top-level 
definitions in modules (functions, classes, imports, global constants).  See 
Tools/lazy_compile/README.txt for details.

--
components: Interpreter Core
messages: 314294
nosy: nascheme
priority: low
severity: normal
stage: patch review
status: open
title: Lazy execution of module bytecode
type: enhancement

___
Python tracker 

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Eric V. Smith

Change by Eric V. Smith :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread miss-islington

miss-islington  added the comment:


New changeset 3b4c6b16c597aa2356f5658dd67da7dcd4434038 by Miss Islington (bot) 
in branch '3.7':
bpo-32505: dataclasses: raise TypeError if a member variable is of type Field, 
but doesn't have a type annotation. (GH-6192)
https://github.com/python/cpython/commit/3b4c6b16c597aa2356f5658dd67da7dcd4434038


--
nosy: +miss-islington

___
Python tracker 

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



[issue30071] Duck-typing inspect.isfunction()

2018-03-22 Thread Jeroen Demeyer

Jeroen Demeyer  added the comment:

See https://mail.python.org/pipermail/python-ideas/2018-March/049398.html

--

___
Python tracker 

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



[issue30953] Fatal python error when jumping into except clause

2018-03-22 Thread ppperry

ppperry  added the comment:

... with a bad error message, because there are no finally blocks in the code

--

___
Python tracker 

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



PyQt4 QWebView cant load google maps markers

2018-03-22 Thread Xristos Xristoou


I want to create a simple python app using pyqt,QWebView and google maps with 
markers.

The problem is that,the markers does not load inside the QWebView, as you can 
see they load just fine in the browser. 


here the simple code :

 import sys
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 from PyQt4.QtWebKit import *
 import os
 app = QApplication(sys.argv)
 web_view= dialog.findChild(QWebView,"webView")
 
google='https://www.google.gr/maps/place/Granite+Mountain+Hotshots+Memorial+State+Park/@34.1749572,-112.850308,12.78z/data=!4m13!1m7!3m6!1s0x872b08ebcb4c186b:0x423927b17fc1cd71!2zzpHPgc65zrbPjM69zrEsIM6Xzr3Pic68zq3Ovc61z4IgzqDOv867zrnPhM61zq_Otc-C!3b1!8m2!3d34.0489281!4d-111.0937311!3m4!1s0x80d330577faee965:0x66d75aef24890ae1!8m2!3d34.2032843!4d-112.7746582?hl=el'
 web_view2.load(QUrl(google))
 web_view2.show()
 sys.exit(app.exec_())


error message :
right click and select Inspect, then go to console and observe the messages 
console I take this error :


TypeError: 'undefined' is not a function (evaluating 'this.D.bind(this)') 
marker.js:58 




Any idea how to can fix that ?
I need to add more settings to QWebView to work google maps with markers ?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset 56970b8ce9d23269d20a76f13c80e670c856ba7f by Eric V. Smith in 
branch 'master':
bpo-32505: dataclasses: raise TypeError if a member variable is of type Field, 
but doesn't have a type annotation. (GH-6192)
https://github.com/python/cpython/commit/56970b8ce9d23269d20a76f13c80e670c856ba7f


--

___
Python tracker 

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5940

___
Python tracker 

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

LGTM.

> What should I write instead of _?

(ValueError, OSError)

> And will the next call be effective (do anything), if we have already set the 
> limit with the testing call?

This doesn't matter. We test that it doesn't crash when parse arguments.

--

___
Python tracker 

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



Re: Putting Unicode characters in JSON

2018-03-22 Thread Tobiah

On 03/22/2018 01:09 PM, Chris Angelico wrote:

On Fri, Mar 23, 2018 at 6:46 AM, Tobiah  wrote:

I have some mailing information in a Mysql database that has
characters from various other countries.  The table says that
it's using latin-1 encoding.  I want to send this data out
as JSON.

So I'm just taking each datum and doing 'name'.decode('latin-1')
and adding the resulting Unicode value right into my JSON structure
before doing .dumps() on it.  This seems to work, and I can consume
the JSON with another program and when I print values, they look nice
with the special characters and all.

I was reading though, that JSON files must be encoded with UTF-8.  So
should I be doing string.decode('latin-1').encode('utf-8')?  Or does
the json module do that for me when I give it a unicode object?


Reconfigure your MySQL database to use UTF-8. There is no reason to
use Latin-1 in the database.

If that isn't an option, make sure your JSON files are pure ASCII,
which is the common subset of UTF-8 and Latin-1.

ChrisA



It works the way I'm doing it.  I checked and it turns out that
whether I do datum.decode('latin-1') or datum.decode('latin-1').encode('utf8')
I get identical JSON files after .dumps().
--
https://mail.python.org/mailman/listinfo/python-list


Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 6:46 AM, Tobiah  wrote:
> I have some mailing information in a Mysql database that has
> characters from various other countries.  The table says that
> it's using latin-1 encoding.  I want to send this data out
> as JSON.
>
> So I'm just taking each datum and doing 'name'.decode('latin-1')
> and adding the resulting Unicode value right into my JSON structure
> before doing .dumps() on it.  This seems to work, and I can consume
> the JSON with another program and when I print values, they look nice
> with the special characters and all.
>
> I was reading though, that JSON files must be encoded with UTF-8.  So
> should I be doing string.decode('latin-1').encode('utf-8')?  Or does
> the json module do that for me when I give it a unicode object?

Reconfigure your MySQL database to use UTF-8. There is no reason to
use Latin-1 in the database.

If that isn't an option, make sure your JSON files are pure ASCII,
which is the common subset of UTF-8 and Latin-1.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Eric V. Smith

Change by Eric V. Smith :


--
keywords: +patch
pull_requests: +5939
stage:  -> patch review

___
Python tracker 

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



Putting Unicode characters in JSON

2018-03-22 Thread Tobiah

I have some mailing information in a Mysql database that has
characters from various other countries.  The table says that
it's using latin-1 encoding.  I want to send this data out
as JSON.

So I'm just taking each datum and doing 'name'.decode('latin-1')
and adding the resulting Unicode value right into my JSON structure
before doing .dumps() on it.  This seems to work, and I can consume
the JSON with another program and when I print values, they look nice
with the special characters and all.

I was reading though, that JSON files must be encoded with UTF-8.  So
should I be doing string.decode('latin-1').encode('utf-8')?  Or does
the json module do that for me when I give it a unicode object?


Thanks






--
https://mail.python.org/mailman/listinfo/python-list


Re: I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Thomas Jollans
On 2018-03-22 19:37, Damjan Stojanovski wrote:
> i am sorry but i can not find a way to attach an image here so you can see 
> what i mean. Please someone tell me how to add an image here.
> 

This is a text only list.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Yury Selivanov

Yury Selivanov  added the comment:

> I suppose that it would also be difficult to get buy-in for a feature like 
> this from the different frameworks?

Maybe :)  Ideally, asyncio programs should not depend on how exactly tasks are 
scheduled.

--

___
Python tracker 

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2018-03-22 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

And will the next call be effective (do anything), if we have already set the 
limit with the testing call?

--

___
Python tracker 

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2018-03-22 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

Thanks! I also thought about this simplest way. What about this:

diff --git a/Python/Lib/test/test_resource.py b/Python/Lib/test/test_resource.py
index de29d3b..bec4440 100644
--- a/Python/Lib/test/test_resource.py
+++ b/Python/Lib/test/test_resource.py
@@ -102,16 +102,21 @@ class ResourceTest(unittest.TestCase):
 
 # Issue 6083: Reference counting bug
 def test_setrusage_refcount(self):
+howmany = 100
 try:
 limits = resource.getrlimit(resource.RLIMIT_CPU)
 except AttributeError:
 self.skipTest('RLIMIT_CPU not available')
+try:
+resource.setrlimit(resource.RLIMIT_CPU, (howmany, howmany))
+except _:
+self.skipTest('Setting RLIMIT_CPU not possible')
 class BadSequence:
 def __len__(self):
 return 2
 def __getitem__(self, key):
 if key in (0, 1):
-return len(tuple(range(100)))
+return len(tuple(range(howmany)))
 raise IndexError
 
 resource.setrlimit(resource.RLIMIT_CPU, BadSequence())

What should I write instead of _?

--

___
Python tracker 

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



Re: I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Terry Reedy

On 3/22/2018 2:37 PM, Damjan Stojanovski wrote:

i am sorry but i can not find a way to attach an image here so you can see what 
i mean. Please someone tell me how to add an image here.


You cannot and there is no need.  List is text only, no attachments. 
Reduce code to the minimum needed to get error.  Copy and paste both 
code and trackback.




--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Larry Martell
On Thu, Mar 22, 2018 at 2:37 PM, Damjan Stojanovski
 wrote:
> i am sorry but i can not find a way to attach an image here so you can see 
> what i mean. Please someone tell me how to add an image here.

You can't. Copy/paste the error. And please include the post you are
replying to.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Damjan Stojanovski
i am sorry but i can not find a way to attach an image here so you can see what 
i mean. Please someone tell me how to add an image here.

Thanks
Dan
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The simplest way is to try passing the limit as a tuple

resource.setrlimit(resource.RLIMIT_CPU, (100, 100))

and skip the test if it failed.

--

___
Python tracker 

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



I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Damjan Stojanovski
Dear all

I am totally new in learning Python and i am learning from a beginner's book 
called automate the boring stuff with Python and i downloaded the Python 64 bit 
version for Windows and i started writing some examples from the book. At the 
end whenever i try to run the program i keep getting an error message and it 
shows that the error is in the beginning in the version of Python.
(See a pic bellow)

Can someone help me and tell me what to do and why is this error showing up???

Thanks
Dan
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

Yet another paradigm is the likes of `GSource` in gnome's glib. GSource "tasks" 
added to the event loop are polled by the event loop for readiness before the 
event loop blocks on select/epoll/etc.. The ones that are ready are removed 
from the loop and their callbacks are dispatched.

I suppose that it would also be difficult to get buy-in for a feature like this 
from the different frameworks?

--

___
Python tracker 

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



[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

I'll have to settle for `set_write_buffer_limits(0, 0)` for my blocking wrapper 
case.

I think that 'write_buffer_drained' callback is a good idea, though.

--

___
Python tracker 

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



[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

> 'events.AbstractEventLoop.run_one_step()'

> This is highly unlikely to ever happen.

Sure, I can see how that could be a problem with other underlying 
implementations, such as Twisted reactor. Just wishful thinking :).

--

___
Python tracker 

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



[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-22 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Does this mean that GC uses most part of CPU time so the loop blocks?

GC stops all Python code in the OS process from running.  Because of the GIL 
code in threads will obviously be stopped too.  This is true for both CPython 
and PyPy at this moment.

> And another question: do you have any plans to optimize the loop so it would 
> be possible to run really lot of tasks in parallel?

The only way of doing this is to have a few asyncio OS processes (because of 
the GIL we can't implement M:N scheduling in a single Python process).  So it's 
not going to happen in the foreseeable future :(

--

___
Python tracker 

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



[issue33123] Path.unlink should have a missing_ok parameter

2018-03-22 Thread Roundup Robot

Change by Roundup Robot :


--
keywords: +patch
pull_requests: +5938
stage:  -> patch review

___
Python tracker 

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



[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Yury Selivanov

Yury Selivanov  added the comment:

> 'events.AbstractEventLoop.run_one_step()'

This is highly unlikely to ever happen.  It's hard to define what one iteration 
of an event loop is, and it would be even harder to get that agreement for all 
frameworks/event loops that are compatible with or based on asyncio.

--

___
Python tracker 

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



[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Yury Selivanov

Yury Selivanov  added the comment:

Yeah, I think your best option would be to use `set_write_buffer_limits(0, 0)`. 
 You don't need asyncio flow control anyways, as AMQP protocol is unlikely to 
generate any pressure on IO buffers.

--

___
Python tracker 

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



[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

... or `events.AbstractEventLoop.run_one_iteration()`.

--

___
Python tracker 

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



[issue33123] Path.unlink should have a missing_ok parameter

2018-03-22 Thread rbu

New submission from rbu :

Similarly to how several pathlib file creation functions have an "exists_ok" 
parameter, we should introduce "missing_ok" that makes removal functions not 
raise an exception when a file or directory is already absent.

IMHO, this should cover Path.unlink and Path.rmdir.

Note, Path.resolve() has a "strict" parameter since 3.6 that does the same 
thing. Naming this of this new parameter tries to be consistent with the 
"exists_ok" parameter as that is more explicit about what it does (as opposed 
to "strict").

--
components: Library (Lib)
messages: 314277
nosy: rbu
priority: normal
severity: normal
status: open
title: Path.unlink should have a missing_ok parameter
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-22 Thread Brett Cannon

Brett Cannon  added the comment:

I can't make any promises unfortunately.

--

___
Python tracker 

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



[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-22 Thread Marat Sharafutdinov

Marat Sharafutdinov  added the comment:

Does this mean that GC uses most part of CPU time so the loop blocks?

And another question: do you have any plans to optimize the loop so it would be 
possible to run really lot of tasks in parallel?

Thanks.

--

___
Python tracker 

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



[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

Thank you for following up. My use case is this:

In the Pika AMQP client package, we have a blocking AMQP connection adapter - 
`BlockingConnection` - wrapped around an asynchronous AMQP connection adapter. 
Presently, BlockingConnection is wrapped around the asynchronous 
`SelectConnection` which has a home-grown proprietary IOLoop. I would like to 
switch BlockingConnection to use an asyncio-based adapter when running on 
Python3.

SelectConnection's proprietary IOLoop provides a single-stepping run function 
(poll with a timeout as normally determined by pending callbacks, timers, etc., 
process all ready events/timers/callbacks, and return). When BlockingConnection 
needs to send something to the AMQP broker and/or wait for an expected reply, 
it sends the request (which typically gets queued up in a write buffer) and 
then runs the proprietary IOLoop's single-stepping method in a loop (thus 
blocking efficiently on I/O); each time after the single-stepping IOLoop method 
returns, BlockingConnection checks whether the conditions of interest have been 
satisfied (e.g., the write buffer size being zero and AMQP Channel.OpenOk has 
been received).

So, another way that asyncio could help, and certainly simplest for me and my 
use case, is by providing a single-stepping function in the event loop 
implementations, such as the single-stepping method that I described at the top 
of the previous paragraph. E.g., `events.AbstractEventLoop.run_one_step()`.

--

___
Python tracker 

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2018-03-22 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

>>> import resource
>>> resource.getrlimit(resource.RLIMIT_CPU) 
(7200, 7260)

--

___
Python tracker 

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



[issue30953] Fatal python error when jumping into except clause

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This is fixed in 3.8.

Traceback (most recent call last):
  File "issue30953.py", line 15, in 
error()
  File "issue30953.py", line 14, in error
pass
  File "issue30953.py", line 14, in error
pass
  File "issue30953.py", line 4, in trace
frame.f_lineno = 12
ValueError: can't jump into or out of a 'finally' block

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-22 Thread Yury Selivanov

Yury Selivanov  added the comment:

We'll likely add 'write_buffer_drained' callback method to `asyncio.Protocol` 
in 3.8.  In the meanwhile, the only option would be using `_make_empty_waiter` 
in 3.7, or set_write_buffer_limits(0, 0).

What's your use case, by the way?

--
versions:  -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue33120] infinite loop in inspect.unwrap(unittest.mock.call)

2018-03-22 Thread Peter

Peter  added the comment:

I see two options to fix it:

1) add recursion depth check to inspect.wrap
2) define __wrapped__ on mock._Call so it won't go into recursion.

--

___
Python tracker 

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



[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-03-22 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Thanks, Raymond.  I'll take a look.

--

___
Python tracker 

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What does resource.getrlimit(resource.RLIMIT_CPU) return?

--

___
Python tracker 

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



[issue33082] multiprocessing docs bury very important 'callback=' args

2018-03-22 Thread Chad

Chad  added the comment:

On topic: My CLA is signed as of Monday, 19 March. My status here is not 
updated yet.


pitrou, off-topic: Without callbacks, users who want multiprocessing functions 
to return something, not just mutate state somewhere else, must gather jobs in 
a list and continually iterate through them polling to see if each has finished 
yet and conditionally popping it from the list. It's expensive and ugly and 
error-prone. Callbacks are really great, you should try them again.

So much better:

pool.apply_async(func, args, callback=when_finished_call_with_result)

--

___
Python tracker 

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



[issue33027] handling filename encoding in Content-Disposition by cgi.FieldStorage

2018-03-22 Thread Paweł

Paweł  added the comment:

duplicate of https://bugs.python.org/issue23434

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue23434] support encoded filename in Content-Disposition for HTTP in cgi.FieldStorage

2018-03-22 Thread Paweł

Paweł  added the comment:

I didn't find this and created a duplicate
https://bugs.python.org/issue33027

I've added similar/updated changes
https://github.com/python/cpython/pull/6027

@r.david.murray wouldn't it be wise to do one step at a time rather than 
implementing full support for RFC6266? Please tell exactly what is your 
expectations so I can fix the patch if it needs to be fixed.

This is also related to RFC5987
https://tools.ietf.org/html/rfc5987
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition

--
components: +Unicode
nosy: +ezio.melotti, pawciobiel, vstinner
pull_requests: +5937
stage:  -> patch review
title: RFC6266 support (Content-Disposition for HTTP) -> support encoded 
filename in Content-Disposition for HTTP in cgi.FieldStorage
versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.7, Python 3.8

___
Python tracker 

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2018-03-22 Thread Ivan Zakharyaschev

Ivan Zakharyaschev  added the comment:

> New changeset a4c85f9b8f58 by Serhiy Storchaka in branch '2.7':
Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple
http://hg.python.org/cpython/rev/a4c85f9b8f58

This test has a problem: though it tests not the ability to set a CPU hard 
limit, it fails if the hard limit is limited. Perhaps, ignore any exception 
there? Could you please help me re-write it correctly, so that I can run it on 
gyle--ALT's builder host--successfully):

# Issue 6083: Reference counting bug
def test_setrusage_refcount(self):
try:
limits = resource.getrlimit(resource.RLIMIT_CPU)
except AttributeError:
self.skipTest('RLIMIT_CPU not available')
class BadSequence:
def __len__(self):
return 2
def __getitem__(self, key):
if key in (0, 1):
return len(tuple(range(100)))
raise IndexError

resource.setrlimit(resource.RLIMIT_CPU, BadSequence())

The failure:

[builder@team ~]$ python /usr/lib64/python2.7/test/test_resource.py
test_args (__main__.ResourceTest) ... ok
test_fsize_enforced (__main__.ResourceTest) ... ok
test_fsize_ismax (__main__.ResourceTest) ... ok
test_fsize_toobig (__main__.ResourceTest) ... ok
test_getrusage (__main__.ResourceTest) ... ok
test_setrusage_refcount (__main__.ResourceTest) ... ERROR

==
ERROR: test_setrusage_refcount (__main__.ResourceTest)
--
Traceback (most recent call last):
  File "/usr/lib64/python2.7/test/test_resource.py", line 117, in 
test_setrusage_refcount
resource.setrlimit(resource.RLIMIT_CPU, BadSequence())
ValueError: not allowed to raise maximum limit

--
Ran 6 tests in 0.085s

FAILED (errors=1)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/test/test_resource.py", line 123, in 
test_main()
  File "/usr/lib64/python2.7/test/test_resource.py", line 120, in test_main
test_support.run_unittest(ResourceTest)
  File "/usr/lib64/python2.7/test/support/__init__.py", line 1577, in 
run_unittest
_run_suite(suite)
  File "/usr/lib64/python2.7/test/support/__init__.py", line 1542, in _run_suite
raise TestFailed(err)
test.support.TestFailed: Traceback (most recent call last):
  File "/usr/lib64/python2.7/test/test_resource.py", line 117, in 
test_setrusage_refcount
resource.setrlimit(resource.RLIMIT_CPU, BadSequence())
ValueError: not allowed to raise maximum limit

[builder@team ~]$

--
nosy: +imz

___
Python tracker 

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Eric V. Smith

Eric V. Smith  added the comment:

Thanks for the offer. I've already got the code written, I just need to write 
some tests. I'll get it done real soon now.

--
components: +Library (Lib)
versions: +Python 3.8

___
Python tracker 

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



[issue30416] constant folding opens compiler to quadratic time hashing

2018-03-22 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +benjamin.peterson
priority: normal -> deferred blocker
versions: +Python 2.7 -Python 3.7

___
Python tracker 

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



[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-22 Thread Ned Deily

Change by Ned Deily :


--
Removed message: https://bugs.python.org/msg314252

___
Python tracker 

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



[issue19979] Missing nested scope vars in class scope (bis)

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This looks like a duplicate of issue9226.

--
nosy: +serhiy.storchaka
status: open -> pending

___
Python tracker 

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



[issue33122] ftplib: FTP_TLS seems to have problems with sites that close the encrypted channel themselfes

2018-03-22 Thread Jürgen

New submission from Jürgen :

Hi,

I'm not quite sure, if you would actually call this a bug, but it is very 
molesting at least ;o)

I use ftplib.FTP_TLS to connect to a z/OS ftp server. With a minor change it 
works very well (happy to have found this library).
The problem I have is, that without any change, an exception is raised after 
every single command I invoke, even though the server sends back an ok message.

The exception is an OSError which is raised while executing conn.unwrap(). It 
seems the connection is already closed when this is called and thus an 
exception is raised. But handling this exception outside the FTP_TLS-class 
makes no sense, because then every command would raise an exception and the 
"good" exceptions could not be distinguised from the ones that are really 
searious so easily anymore (I mean: if i get an exception that a connection 
could not be closed, because someone else closed it before, that's not very 
serious, is it?).

Suggestions to solve this:
small solution: allow the programmer to decide what to do, by creating 
subclasses
This is "factor-out" the unwrap logic in a separate method or function, so at 
least users of the class can overwrite the behavior, without having to rebuild 
the whole logic of the affected methods.

In my quick solution I created a new method in class FTP:
def __handleAutoCloseSSL__(self, conn):
if self.autoCloseModeSSL == 'NONE' or self.autoCloseModeSSL is None or 
_SSLSocket is None or not isinstance(conn, _SSLSocket):
# do nothing
pass
elif self.autoCloseModeSSL in ('SAFE', 'HIDE'):
try:
conn.unwrap()
except OSError as ex:
if self.autoCloseModeSSL != 'HIDE':
print('Caught exception %s while calling conn.unwrap()' % 
str(ex))
else:
# Standard mode (usally self.autoCloseModeSSL =='STANDARD' but 
anything else is accepted as well)
# the original code was:
#if _SSLSocket is not None and isinstance(conn, _SSLSocket):
#conn.unwrap()
conn.unwrap()

And the class variable:
autoCloseModeSSL = 'STANDARD'

Then I called it from methods (instead of doing conn.unwrap() there directly):
retbinary
retlines
storbinary
storlines

Ok, maybe not that sexy, but it works :o)
And if you don't like the hack with instance variable autoCloseModeSSL, you 
could just transfer the original conn.unwrap() in an extra method which could 
then be overwritten by programmers in subclasses. This would already help me 
very much, because I know that patching a library is not a good idea. Even more 
if it is a communication library that might be updated from time to time.

--
components: Library (Lib)
messages: 314261
nosy: jottbe
priority: normal
severity: normal
status: open
title: ftplib: FTP_TLS seems to have problems with sites that close the 
encrypted channel themselfes
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue33121] recv returning 0 on closed connection not documented

2018-03-22 Thread joders

New submission from joders :

The "Linux Programmer's Manual" states:

When a stream socket peer has performed an orderly shutdown, the return value 
will be 0 (the traditional "end-of-file" return).

I find that information pretty important which is why I am asking if you might 
want to add it to the python documentation as well. It would have prevented a 
bug in my code.

--
assignee: docs@python
components: Documentation
messages: 314260
nosy: docs@python, joders
priority: normal
severity: normal
status: open
title: recv returning 0 on closed connection not documented
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

> you'll notice that's an error?

Yes, but there are other scenarios, like using `init=False` or updating 
existing class definition and forgetting to update call sites (which will still 
work), etc.

What would we lose by not flagging this as an error? I think there are no 
legitimate use cases for such code, and implementation is straightforward. If 
you don't have time I can do this myself.

--

___
Python tracker 

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



[issue17861] put opcode information in one place

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Currently an explicit `make regen-opcode` and `make regen-opcode-targets` (or 
just `make regen-all`) are needed for regenerating C files from opcode.py.

Is anything left to do in this issue?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

I am closing this for now. We can re-open it later if problems will appear in 
3.7.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 5d8bb5d07be2a9205e7059090f0ac5360d36b217 by Ivan Levkivskyi (Miss 
Islington (bot)) in branch '3.7':
bpo-32999: Revert GH-6002 (fc7df0e6) (GH-6189) (GH-6190)
https://github.com/python/cpython/commit/5d8bb5d07be2a9205e7059090f0ac5360d36b217


--

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 5d8bb5d07be2a9205e7059090f0ac5360d36b217 by Ivan Levkivskyi (Miss 
Islington (bot)) in branch '3.7':
bpo-32999: Revert GH-6002 (fc7df0e6) (GH-6189) (GH-6190)
https://github.com/python/cpython/commit/5d8bb5d07be2a9205e7059090f0ac5360d36b217


--

___
Python tracker 

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



ANN: PyScripter v3.3.0 released

2018-03-22 Thread pyscripter
PyScripter is a free and open-source Python Integrated Development Environment 
(IDE) created with the ambition to become competitive in functionality with 
commercial Windows-based IDEs available for other languages.  It is 
feature-rich, but also light-weight. 

The major new feature of this release is support for thread debugging. 

See: 
Announcement: 
https://pyscripter.blogspot.gr/2018/03/pyscripter-version-322-released.html
Project hoe: https://github.com/pyscripter/pyscripter/ 
Features: https://github.com/pyscripter/pyscripter/wiki/Features 
Downloads: https://sourceforge.net/projects/pyscripter/files
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[issue33120] infinite loop in inspect.unwrap(unittest.mock.call)

2018-03-22 Thread Peter

New submission from Peter :

The following module will eat all available RAM if executed:

import inspect
import unittest.mock
print(inspect.unwrap(unittest.mock.call))

inspect.unwrap has loop protection against functions that wrap themselves, but 
unittest.mock.call creates new object on demand.

--
components: Library (Lib)
messages: 314254
nosy: peterdemin
priority: normal
severity: normal
status: open
title: infinite loop in inspect.unwrap(unittest.mock.call)
type: crash
versions: Python 3.6

___
Python tracker 

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



PyDev 6.3.2 released

2018-03-22 Thread Fabio Zadrozny
 PyDev 6.3.2 Release Highlights

PyDev changes:

   -

   Type inference
   - PyDev can now uses information on .pyi files (when along the typed .py
  file) for type inference.
   -

   Fixed issue opening code completion preferences page.

About PyDev

PyDev is an open-source Python IDE on top of Eclipse for Python, Jython and
IronPython development, now also available for Python on Visual Studio Code.

It comes with goodies such as code completion, syntax highlighting, syntax
analysis, code analysis, refactor, debug, interactive console, etc.

It is also available as a standalone through LiClipse with goodies such as
multiple cursors, theming and support for many other languages, such as
Django Templates, Jinja2, Html, JavaScript, etc.

Links:

PyDev: http://pydev.org
PyDev Blog: http://pydev.blogspot.com
PyDev on VSCode: http://pydev.org/vscode
LiClipse: http://www.liclipse.com
PyVmMonitor - Python Profiler: http://www.pyvmmonitor.com/

Cheers,

Fabio Zadrozny
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


PyCA cryptography 2.2.1 released

2018-03-22 Thread Paul Kehrer
PyCA cryptography 2.2.1 has been released to PyPI. cryptography includes
both high level recipes and low level interfaces to common cryptographic
algorithms such as symmetric ciphers, message digests, and key derivation
functions. We support Python 2.7, Python 3.4+, and PyPy.

Changelog (https://cryptography.io/en/latest/changelog/#v2-2-1
):

* Reverted a change to GeneralNames which prohibited having zero elements,
due to breakages.
* Fixed a bug in aes_key_unwrap_with_padding() that caused it to raise
InvalidUnwrap when key length modulo 8 was zero.

-Paul Kehrer (reaperhulk)
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[issue32234] Add context management to mailbox.Mailbox

2018-03-22 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

It looks like Barry was ready to merge this PR in December.  Is there anything 
else that needs to be done for it?  Thanks!

--
nosy: +csabella

___
Python tracker 

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



[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-22 Thread Viv

Viv  added the comment:

Thanks, worked a treat https://www.allcarleasing.co.uk/special-offers/

--
nosy: +Viv

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-22 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5935

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5936

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset f757b72b2524ce3451d2269f0b8a9f0593a7b27f by INADA Naoki in branch 
'master':
bpo-32999: Revert GH-6002 (fc7df0e6) (GH-6189)
https://github.com/python/cpython/commit/f757b72b2524ce3451d2269f0b8a9f0593a7b27f


--

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-22 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset f757b72b2524ce3451d2269f0b8a9f0593a7b27f by INADA Naoki in branch 
'master':
bpo-32999: Revert GH-6002 (fc7df0e6) (GH-6189)
https://github.com/python/cpython/commit/f757b72b2524ce3451d2269f0b8a9f0593a7b27f


--

___
Python tracker 

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



[issue23203] Aliasing import of sub-{module, package} from the package raises AttributeError on import.

2018-03-22 Thread Nick Coghlan

Nick Coghlan  added the comment:

Heh, apparently I forgot how IMPORT_FROM currently works some time between 2015 
and 2017 :)

I agree this is out of date now, as the requested behaviour was already 
implemented for 3.7

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
superseder:  -> Treat `import a.b.c as m` as `m = sys.modules['a.b.c']`

___
Python tracker 

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



[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-22 Thread Nick Coghlan

Nick Coghlan  added the comment:

Brett or Eric, any chance one of you could run with this for 3.7b3? I already 
have a startup refactoring related regression that I'm aiming to have fixed 
before then.

Thanks to Victor's refactoring work, there's at least a clear interception 
point now where we can treat the empty string differently depending on whether 
the command line option was `-c`, `-m`, or not specified at all: 
https://github.com/python/cpython/blob/master/Python/pathconfig.c#L259

As an initial attempt, I think the necessary fix will be along the lines of 
checking for 'n == 0 && argc > 1 && wcscmp(argv0, L"-m") == 0', and resolving 
the current working directory in that case.

--

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-22 Thread INADA Naoki

Change by INADA Naoki :


--
pull_requests: +5933

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread INADA Naoki

Change by INADA Naoki :


--
pull_requests: +5934

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread miss-islington

miss-islington  added the comment:


New changeset 346964ba0586e402610ea886e70bee1294874781 by Miss Islington (bot) 
in branch '3.7':
bpo-33018: Improve issubclass() error checking and message. (GH-5944)
https://github.com/python/cpython/commit/346964ba0586e402610ea886e70bee1294874781


--
nosy: +miss-islington

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread miss-islington

Change by miss-islington :


--
keywords: +patch
pull_requests: +5932
stage:  -> patch review

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-22 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 40472dd42de4f7265d456458cd13ad6894d736db by Ivan Levkivskyi (jab) 
in branch 'master':
bpo-33018: Improve issubclass() error checking and message. (GH-5944)
https://github.com/python/cpython/commit/40472dd42de4f7265d456458cd13ad6894d736db


--

___
Python tracker 

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



[issue23203] Aliasing import of sub-{module, package} from the package raises AttributeError on import.

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Is anything left to do with this issue after issue30024?

--

___
Python tracker 

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



[issue30076] Opcode names BUILD_MAP_UNPACK_WITH_CALL and BUILD_TUPLE_UNPACK_WITH_CALL are too long

2018-03-22 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage:  -> needs patch
versions: +Python 3.6, Python 3.8

___
Python tracker 

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



[issue32838] Fix Python versions in the table of magic numbers

2018-03-22 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue25828] PyCode_Optimize() (peephole optimizer) doesn't handle KeyboardInterrupt correctly

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I can reproduce a crash in 3.5, but not in 3.6. Seems it was fixed in 
issue30416.

--

___
Python tracker 

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



[issue24565] the f_lineno getter is broken

2018-03-22 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

I will work on it shortly.

--

___
Python tracker 

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



[issue25782] CPython hangs on error __context__ set to the error itself

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What should we do with this issue? Does it need opening a topic on Python-Dev?

--

___
Python tracker 

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



[issue28962] Crash when throwing an exception with a malicious __hash__ override

2018-03-22 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
versions:  -Python 3.3

___
Python tracker 

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



[issue28962] Crash when throwing an exception with a malicious __hash__ override

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Seems it was fixed somewhere between 3.6.3 and 3.6.5+.

Traceback (most recent call last):
  File "baderror.py", line 10, in 
raise e from e
__main__.BadError

3.5 is now in security-only fixes stage, and this doesn't look like a security 
issue.

--
nosy: +serhiy.storchaka
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue26286] dis module: coroutine opcode documentation clarity

2018-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

(2) is already fixed.

SETUP_ASYNC_WITH talks about the same frame blocks as pushed by SETUP_FINALLY, 
SETUP_EXCEPT, SETUP_LOOP and popped by POP_BLOCK. But unlike to SETUP_FINALLY 
it pushes a frame block pointing below TOS. This detail needs to be documented.

Do you mind to create a pull request Jim?

--
nosy: +serhiy.storchaka
versions: +Python 3.6, Python 3.7, Python 3.8 -Python 3.5

___
Python tracker 

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



  1   2   >