[issue38852] test_recursion_limit in test_threading crashes with SIGSEGV on android

2019-12-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 00ada2c1d57c5b8b468bad32ff24fa14113ae5c7 by Victor Stinner 
(xdegaye) in branch 'master':
bpo-38852: Set thread stack size to 8 Mb for debug builds on android platforms 
(GH-17337)
https://github.com/python/cpython/commit/00ada2c1d57c5b8b468bad32ff24fa14113ae5c7


--
nosy: +vstinner

___
Python tracker 

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



[issue38991] Remove test.support.strip_python_stderr()

2019-12-07 Thread STINNER Victor


Change by STINNER Victor :


--
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



[issue38991] Remove test.support.strip_python_stderr()

2019-12-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6cac1136665b70f72db291b95876d7affcf1d2db by Victor Stinner in 
branch 'master':
bpo-38991: Remove test.support.strip_python_stderr() (GH-17490)
https://github.com/python/cpython/commit/6cac1136665b70f72db291b95876d7affcf1d2db


--

___
Python tracker 

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



[issue38708] parse_message_id in email module is very buggy / crashy

2019-12-07 Thread Abhilash Raj


Change by Abhilash Raj :


--
keywords: +patch
pull_requests: +16981
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17504

___
Python tracker 

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



[issue38698] While parsing email message id: UnboundLocalError

2019-12-07 Thread Abhilash Raj


Change by Abhilash Raj :


--
pull_requests: +16980
pull_request: https://github.com/python/cpython/pull/17503

___
Python tracker 

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



Re: stuck on time

2019-12-07 Thread Terry Reedy

On 12/7/2019 1:56 PM, RobH wrote:


    current_time = time.strftime("%I:%M")<<< stays at this line

in an interactive Python interpreter ?


In IDLE on Windows with 3.7 and 3.9, time.strftime runs fine.

>>> import time
>>> time.strftime("%I:%M")
'11:48'
>>> current_time = time.strftime("%I:%M")
>>> current_time
'11:48'

--
Terry Jan Reedy


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


[issue38987] 3.8.0 on GNU/Linux fails to find shared library

2019-12-07 Thread Ned Deily


Change by Ned Deily :


--
nosy: +doko

___
Python tracker 

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



[issue38995] reverse search (ctrl-r) doest not work

2019-12-07 Thread Ned Deily


Ned Deily  added the comment:

Most likely what is happening is that the two Python instances you are using 
are linked to different versions of the external readline library.  From the 
version information, it's clear that you are using the Python 3.8.0 from the 
python.org macOS installer.  That Python uses the macOS-supplied BSD editline 
(AKA libedit) for readline functionality.  The Python 3.7.3 you have is not 
from python.org and based on the prompt it looks like it was linked with a 
version of GNU readline which probably does bind ^R to the reverse search 
function by default.  As described in the Python Library Reference page for 
readline (https://docs.python.org/3/library/readline.html), both GNU readline 
and BSD editline can be tailored via configuration files; GNU readline uses 
~/.inputrc while BSD editline uses ~/.editrc.

On macOS, the available configuration commands for editline are described in 
the man page for editrc:

man 5 editrc

In particular, you should be able to enable editline's reverse search 
functionality by adding the following line to ~/.editrc:

bind ^R em-inc-search-prev

where ^R is two characters, not the single character CTRL-R.

--
nosy: +ned.deily
resolution:  -> third party
stage:  -> 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



[issue38995] reverse search (ctrl-r) doest not work

2019-12-07 Thread sush


New submission from sush :

On my MacOS Mojave 10.14.6 (18G103), after upgrading python to python 3.8, the 
ctrl-r on the python interpreter does not work.

Here is the working python 3.7 version:
```
$ python3.7 --version 
Python 3.7.3
$ python3.7 
Python 3.7.3 (default, Mar 27 2019, 09:23:15) 
[Clang 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 10
(reverse-i-search)`a': a = 10
``` 
Note that I pressed 'ctrl-r' on my keyboard to bring up the 'reverse-i-search'.

On python3.8, ctrl-r has no response from the interpreter:
```
$ python3.8 --version
Python 3.8.0
$ python3.8  
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 10
>>> 
```

Interestingly, the ~/.python_history files seems to be updated. Also, when I 
enter the 'UP' key, the older command comes up. Just that ctrl-r doesn't work.

Here is the output showing that python_history files is being written to:
```
$ rm  ~/.python_history  
$ python3.8   
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 33
>>> ^D
$ cat  ~/.python_history 
_HiStOrY_V2_
a\040=\04033
```

--
components: Interpreter Core
messages: 357991
nosy: sush
priority: normal
severity: normal
status: open
title: reverse search (ctrl-r) doest not work
type: behavior
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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-07 Thread Kyle Stanley


Kyle Stanley  added the comment:

> Where are we with this?  The deadline for 3.8.1 and 3.7.6 is coming up in a 
> few days.

I believe we're just waiting on review and additional feedback on GH-17311, 
which implements Antoine's proposal. The only remaining component I can think 
of is the "What's New" entry, but I was planning on doing that in a separate PR 
so that we could get the security fix out there first (and simplify the merge 
conflicts for the backports).

--

___
Python tracker 

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



Re: IOError: cannot open resource

2019-12-07 Thread Python

RobH wrote:

On 07/12/2019 16:04, Peter Otten wrote:

RobH wrote:


When I run a python project with an oled display on a rasperry pi zero,
it calls for the Minecraftia.ttf font. I have the said file in
home/pi/.fonts/

I get this error:

pi@raspberrypi:~/Downloads $ python interdisplay.py
Traceback (most recent call last):
    File "interdisplay.py", line 220, in 
  display_time()
    File "interdisplay.py", line 26, in display_time
  font = ImageFont.truetype('home/pi/.fonts/Minecraftia.ttf', 35)
    File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 280,
in truetype
  return FreeTypeFont(font, size, index, encoding, layout_engine)
    File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 145,
in __init__
  layout_engine=layout_engine)
IOError: cannot open resource

PILLOW version forked from PIL 1.1.7

I have no idea to what to do about this.


You don't have the font "Minecraftia.ttf". You can either try to find and
install it or replace it with another that you already have in the
/home/pi/.fonts directory.

You may even lie about it, e. g. assuming there is a font called
"NotoSerif-Regular.ttf"

$ cd /home/pi/.fonts
$ ln NotoSerif-Regular.ttf Minecraftia.ttf

should fix the error without making changes to the code.



Thanks for that.
I actually replaced Minecraftia.ttf in the code for 
NotoSerif-Regular.ttf, after I put that font in the .font folder.

It now runs without the above errors.


You are a genious.



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


Re: stuck on time

2019-12-07 Thread RobH

On 07/12/2019 21:22, Karsten Hilbert wrote:

On Sat, Dec 07, 2019 at 08:38:20PM +, RobH wrote:


I have tried the code in Thonny and ran it


Notice how I said "line", not "code".

If you hope to debug anything you need to be precise.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



Sorry, I should have said just the line, and it didn't return anything.
Is Thonny an interpreter then.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Unicode filenames

2019-12-07 Thread Chris Angelico
On Sun, Dec 8, 2019 at 8:33 AM Bob van der Poel  wrote:
> Yeah, heard all that before :) But, seriously, I wonder how many short
> (less than 100 lines) programs there are out there written in py2 that will
> not run in py3. Good thing py2 will still be available to be installed for
> many, many years!

If they're that short and people are depending on them, it won't be
too much work to port them. And you gain a huge measure of
reliability: you no longer have to worry about "Unicode filenames" -
or, to be more precise, "non-ASCII filenames" - because everything
will just work.

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


Re: Unicode filenames

2019-12-07 Thread Bob van der Poel
On Sat, Dec 7, 2019 at 12:47 PM DL Neil via Python-list <
python-list@python.org> wrote:

> On 8/12/19 5:50 AM, Bob van der Poel wrote:
> > On Sat, Dec 7, 2019 at 4:00 AM Barry Scott 
> wrote:
> >>> On 6 Dec 2019, at 18:17, Bob van der Poel  wrote:
> >>>
> >>> I have some files which came off the net with, I'm assuming, unicode
> >>> characters in the names. I have a very short program which takes the
> >>> filename and puts into an emacs buffer, and then lets me add
> information
> >> to
> >>> that new file (it's a poor man's DB).
> >>>
> >>> Next, I can look up text in the file and open the saved filename.
> >>> Everything works great until I hit those darn unicode filenames.
>
> ...
>
> >> Do you get the error with python 3?
> > I'm running this program on Linux (Ubuntu 19.10) and Python2.
>
> ...
>
> > I've taking the coward's way out and renamed the 1/2 dozen files. Seems
> > that it is when I grab a filename from the DB it is in unicode and the
> the
> > textAtCursor() and then I am trying to open that file using a fork to a
> > pdf-display program. This is all Q stuff so I'm going to file it under
> > "mysteries of life" and live with it :)
>
>
> Fair enough, for such small number no other solution could be as
> efficient! My quick-and-dirty 'solution' would only work for (very few)
> 'old data files' being recognised/name-updated using Python3.
>
>
> Insert here: obligatory warning about the deprecation of Python2 at the
> end of this month/year...
>
>
Yeah, heard all that before :) But, seriously, I wonder how many short
(less than 100 lines) programs there are out there written in py2 that will
not run in py3. Good thing py2 will still be available to be installed for
many, many years!


-- 

 Listen to my FREE CD at http://www.mellowood.ca/music/cedars 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: b...@mellowood.ca
WWW:   http://www.mellowood.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38981] better name for re.error Exception class.

2019-12-07 Thread Matthias Bussonnier


Change by Matthias Bussonnier :


--
keywords: +patch
pull_requests: +16979
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/17501

___
Python tracker 

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



Re: stuck on time

2019-12-07 Thread Karsten Hilbert
On Sat, Dec 07, 2019 at 08:38:20PM +, RobH wrote:

> I have tried the code in Thonny and ran it

Notice how I said "line", not "code".

If you hope to debug anything you need to be precise.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


SQLObject 3.8.0

2019-12-07 Thread Oleg Broytman
Hello!

I'm pleased to announce version 3.8.0, the first stable release of branch
3.8 of SQLObject.


What's new in SQLObject
===

Features


* Add driver ``supersqlite``. Not all tests are passing
  so the driver isn't added to the list of default drivers.

Minor features
--

* Improve sqlrepr'ing ``ALL/ANY/SOME()``: always put the expression
  at the right side of the comparison operation.

Bug fixes
-

* Fixed a bug in cascade deletion/nullification.

* Fixed a bug in ``PostgresConnection.columnsFromSchema``:
  PostgreSQL 12 removed outdated catalog attribute
  ``pg_catalog.pg_attrdef.adsrc``.

* Fixed a bug working with microseconds in Time columns.

CI
--

* Run tests with Python 3.8 at Travis CI.

Contributors for this release are Andrew Trusty, Marco Sirabella and darix.

For a more complete list, please see the news:
http://sqlobject.org/News.html


What is SQLObject
=

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite,
Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB).

Python 2.7 or 3.4+ is required.


Where is SQLObject
==

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Download:
https://pypi.org/project/SQLObject/3.8.0

News and changes:
http://sqlobject.org/News.html

StackOverflow:
https://stackoverflow.com/questions/tagged/sqlobject


Example
===

Create a simple class that wraps a table::

  >>> from sqlobject import *
  >>>
  >>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
  >>>
  >>> class Person(SQLObject):
  ... fname = StringCol()
  ... mi = StringCol(length=1, default=None)
  ... lname = StringCol()
  ...
  >>> Person.createTable()

Use the object::

  >>> p = Person(fname="John", lname="Doe")
  >>> p
  
  >>> p.fname
  'John'
  >>> p.mi = 'Q'
  >>> p2 = Person.get(1)
  >>> p2
  
  >>> p is p2
  True

Queries::

  >>> p3 = Person.selectBy(lname="Doe")[0]
  >>> p3
  
  >>> pc = Person.select(Person.q.lname=="Doe").count()
  >>> pc
  1

Oleg.
-- 
Oleg Broytmanhttps://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
--
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/

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


[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2019-12-07 Thread Ned Deily


Ned Deily  added the comment:

> I'll elevate the status so that we don't forget before 3.8.1 is too close

Andrew, Yury: ping. 3.8.1 cutoff is approaching.

--
nosy: +ned.deily

___
Python tracker 

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



[issue30458] [security][CVE-2019-9740][CVE-2019-9947] HTTP Header Injection (follow-up of CVE-2016-5699)

2019-12-07 Thread Ned Deily


Ned Deily  added the comment:

What is the status of this issue?  Now that Issue38576 has been opened to cover 
the host address part, can this issue be closed or downgraded?  Should 
Issue38576 be a release blocker?

--

___
Python tracker 

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



Re: stuck on time

2019-12-07 Thread RobH

On 07/12/2019 19:15, Karsten Hilbert wrote:

On Sat, Dec 07, 2019 at 06:56:17PM +, RobH wrote:


What happens if your run this line:


current_time = time.strftime("%I:%M")<<< stays at this line


in an interactive Python interpreter ?

(after you define "time" appropriately)


The python code is in a terminal window or shell, and when I run it only the
time is displayed on an oled display, with no indication elsewhere of
anything else. No errors of any description in the shell. It just appears as
tho the code has stalled.

Could it be the actual font I am using which is causing the stalling.


That does not sound likely because the line you are asserting
it is stuck on does not output anything so where should
whatever font get involved ?

So, what happens if *you* run the line in an *interactive interpreter* ?

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



I have tried the code in Thonny and ran it, but after about 5 minutes 
nothing happened and no errors at all.


Also just running the line in Thonny, nothing happened, no errors.

What program has or is an interactive interpreter, if it's not Thonny
--
https://mail.python.org/mailman/listinfo/python-list


[issue34776] Postponed annotations break inspection of dataclasses

2019-12-07 Thread Ned Deily


Ned Deily  added the comment:

>  I'll elevate the status so that I don't forget before 3.8.1.

Ping, 3.8.1 cutoff is coming up very soon.

--

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-07 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Strictly speaking not all of those _need_ to be touched given the old name is 
always going to exist for backwards compatibility.  But I agree that we should 
update them as part of this regardless.

I'd go forward with a PR.

The only fallout I expect a change like this to have on users is in the very 
odd test scenario where someone has hardcoded the error name in a string.  That 
is rare, especially for an re.error which is generally not an expected 
exception.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue37228] UDP sockets created by create_datagram_endpoint() allow by default multiple processes to bind the same port

2019-12-07 Thread Ned Deily


Ned Deily  added the comment:

Where are we with this?  The deadline for 3.8.1 and 3.7.6 is coming up in a few 
days.

--

___
Python tracker 

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



[issue22367] Add open_file_descriptor parameter to fcntl.lockf() (use the new F_OFD_SETLK flag)

2019-12-07 Thread Ned Deily


Ned Deily  added the comment:

It looks like the only thing left to do yet for this issue is to finish the 
review of and merge the PR that actually implements the new parameter.  
Removing the Deferred Blocker status and deselecting releases other than 3.9.

--
priority: deferred blocker -> 
versions:  -Python 3.5, Python 3.6, 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



Re: Vim settings for Python (was: tab replace to space 4)

2019-12-07 Thread Bill Campbell
On Sat, Dec 07, 2019, Peter J. Holzer wrote:

>As an aside, to prevent vim from inserting tabs in the first place, set
>expandtab
>sw=4
>and maybe also
>ts=4

Inserting a comment in the file like this makes thing easy.

# vim: expandtab sw=4 ts=4 nows wm=0

Bill
-- 
INTERNET:   b...@celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www2.celestial.com/ 6641 E. Mercer Way
Mobile: (206) 947-5591  PO Box 820
Fax:(206) 232-9186  Mercer Island, WA 98040-0820

Political language... is designed to make lies sound truthful and
murder respectable, and to give an appearance of solidity to pure
wind. -- George Orwell
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unicode filenames

2019-12-07 Thread DL Neil via Python-list

On 8/12/19 5:50 AM, Bob van der Poel wrote:

On Sat, Dec 7, 2019 at 4:00 AM Barry Scott  wrote:

On 6 Dec 2019, at 18:17, Bob van der Poel  wrote:

I have some files which came off the net with, I'm assuming, unicode
characters in the names. I have a very short program which takes the
filename and puts into an emacs buffer, and then lets me add information

to

that new file (it's a poor man's DB).

Next, I can look up text in the file and open the saved filename.
Everything works great until I hit those darn unicode filenames.


...


Do you get the error with python 3?

I'm running this program on Linux (Ubuntu 19.10) and Python2.


...


I've taking the coward's way out and renamed the 1/2 dozen files. Seems
that it is when I grab a filename from the DB it is in unicode and the the
textAtCursor() and then I am trying to open that file using a fork to a
pdf-display program. This is all Q stuff so I'm going to file it under
"mysteries of life" and live with it :)



Fair enough, for such small number no other solution could be as 
efficient! My quick-and-dirty 'solution' would only work for (very few) 
'old data files' being recognised/name-updated using Python3.



Insert here: obligatory warning about the deprecation of Python2 at the 
end of this month/year...

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: stuck on time

2019-12-07 Thread Karsten Hilbert
On Sat, Dec 07, 2019 at 06:56:17PM +, RobH wrote:

> > What happens if your run this line:
> >
> > >   current_time = time.strftime("%I:%M")<<< stays at this line
> >
> > in an interactive Python interpreter ?
> >
> > (after you define "time" appropriately)
>
> The python code is in a terminal window or shell, and when I run it only the
> time is displayed on an oled display, with no indication elsewhere of
> anything else. No errors of any description in the shell. It just appears as
> tho the code has stalled.
>
> Could it be the actual font I am using which is causing the stalling.

That does not sound likely because the line you are asserting
it is stuck on does not output anything so where should
whatever font get involved ?

So, what happens if *you* run the line in an *interactive interpreter* ?

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: stuck on time

2019-12-07 Thread RobH

On 07/12/2019 17:54, Karsten Hilbert wrote:

On Sat, Dec 07, 2019 at 05:48:00PM +, RobH wrote:

What happens if your run this line:


current_time = time.strftime("%I:%M")<<< stays at this line


in an interactive Python interpreter ?

(after you define "time" appropriately)

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B



The python code is in a terminal window or shell, and when I run it only 
the time is displayed on an oled display, with no indication elsewhere 
of anything else. No errors of any description in the shell. It just 
appears as tho the code has stalled.


Could it be the actual font I am using which is causing the stalling.
--
https://mail.python.org/mailman/listinfo/python-list


[issue35048] Can't reassign __class__ despite the assigned class having identical slots

2019-12-07 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The relevant logic is in the compatible_for_assignment() function on line 3972 
in Objects/typeobject.c.

After checking that the tp_free slots are the same, it proceeds as follows:

/*
 It's tricky to tell if two arbitrary types are sufficiently compatible as
 to be interchangeable; e.g., even if they have the same tp_basicsize, they
 might have totally different struct fields. It's much easier to tell if a
 type and its supertype are compatible; e.g., if they have the same
 tp_basicsize, then that means they have identical fields. So to check
 whether two arbitrary types are compatible, we first find the highest
 supertype that each is compatible with, and then if those supertypes are
 compatible then the original types must also be compatible.
*/

So what is happening is that "class a" and "class b" aren't being directly 
compared to one another.  Instead, they are being compared to their parent 
"dict".   Since *dict* doesn't have __dict__ or __weakref__, "a" and "b" are 
deemed to have incompatible layouts.   See lines 3951 to 3954 in 
same_slots_added() in Objects/typeobject.c.

--
nosy: +benjamin.peterson, pitrou

___
Python tracker 

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



SQLObject 3.8.0

2019-12-07 Thread Oleg Broytman
Hello!

I'm pleased to announce version 3.8.0, the first stable release of branch
3.8 of SQLObject.


What's new in SQLObject
===

Features


* Add driver ``supersqlite``. Not all tests are passing
  so the driver isn't added to the list of default drivers.

Minor features
--

* Improve sqlrepr'ing ``ALL/ANY/SOME()``: always put the expression
  at the right side of the comparison operation.

Bug fixes
-

* Fixed a bug in cascade deletion/nullification.

* Fixed a bug in ``PostgresConnection.columnsFromSchema``:
  PostgreSQL 12 removed outdated catalog attribute
  ``pg_catalog.pg_attrdef.adsrc``.

* Fixed a bug working with microseconds in Time columns.

CI
--

* Run tests with Python 3.8 at Travis CI.

Contributors for this release are Andrew Trusty, Marco Sirabella and darix.

For a more complete list, please see the news:
http://sqlobject.org/News.html


What is SQLObject
=

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite,
Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB).

Python 2.7 or 3.4+ is required.


Where is SQLObject
==

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Download:
https://pypi.org/project/SQLObject/3.8.0

News and changes:
http://sqlobject.org/News.html

StackOverflow:
https://stackoverflow.com/questions/tagged/sqlobject


Example
===

Create a simple class that wraps a table::

  >>> from sqlobject import *
  >>>
  >>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
  >>>
  >>> class Person(SQLObject):
  ... fname = StringCol()
  ... mi = StringCol(length=1, default=None)
  ... lname = StringCol()
  ...
  >>> Person.createTable()

Use the object::

  >>> p = Person(fname="John", lname="Doe")
  >>> p
  
  >>> p.fname
  'John'
  >>> p.mi = 'Q'
  >>> p2 = Person.get(1)
  >>> p2
  
  >>> p is p2
  True

Queries::

  >>> p3 = Person.selectBy(lname="Doe")[0]
  >>> p3
  
  >>> pc = Person.select(Person.q.lname=="Doe").count()
  >>> pc
  1

Oleg.
-- 
Oleg Broytmanhttps://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Developers are advised to purge these malicious packages

2019-12-07 Thread David Lowry-Duda
On Wed, Dec 04, 2019 at 07:17:58PM +0100, Christian Heimes wrote:
> 
> At least the first pages are packaging files for Debian, Fedora, and
> other Linux distributions. Downstream distributions provide a Python
>
> 
> 
> Attackers abuse the fact and try to typo-squat packages in hope that
> somebody uses the Linux distribution package name "python3-dateutil"
> instead of the upstream name "python-dateutil" in requirements.txt

Yes, I understand. Thank you.

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


[issue38981] better name for re.error Exception class.

2019-12-07 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

Thanks Serhiy, 

Here is a rough idea of how many places would be touched by renaming in the 
`re` module:

https://github.com/Carreau/cpython/commit/59e4c5150c842f849ff3a9ba8a94df1df7a5eb1c
 (50 additions and 42 deletions.). 

I haven't found any places that need changes in the C code, and need to polish 
documentation, rebuild and run the test suite before sending a PR.

--

___
Python tracker 

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



Re: stuck on time

2019-12-07 Thread Karsten Hilbert
On Sat, Dec 07, 2019 at 05:48:00PM +, RobH wrote:

What happens if your run this line:

>   current_time = time.strftime("%I:%M")<<< stays at this line

in an interactive Python interpreter ?

(after you define "time" appropriately)

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


stuck on time

2019-12-07 Thread RobH

I am trying to do this project on a pi zero:

http://frederickvandenbosch.be/?p=1365

After overcoming a few errors, I now have the display working and the 
start of the code showing on the display, that being the time.


It doesn't move on to the next part of the code ie, no rectangle drawn
def display_time():
# Collect current time and date
if(time_format):
current_time = time.strftime("%I:%M")<<< stays at this line
else:
current_time = time.strftime("%H:%M")

current_date = time.strftime("%d/%m/%Y")

# Clear image buffer by drawing a black filled box
draw.rectangle((0,0,width,height), outline=0, fill=0

In the original code you can see that the author used the 
Minecraftia.ttf font, but I had to download the Minecraftia-Regular.ttf 
font. The link the author gave took me to that.


The Minecraft-Regular.ttf font produced errors when the code was run, 
saying at the end of the error that it cannot open resource.


I then used the NotoSerif-Regular.ttf font which let the code start 
without error, but as above it is stuck at the time.

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


Re: IOError: cannot open resource

2019-12-07 Thread RobH

On 07/12/2019 16:58, Michael Torrie wrote:

On 12/7/19 9:48 AM, RobH wrote:

On 07/12/2019 16:00, Dan Sommers wrote:

On 12/7/19 9:43 AM, RobH wrote:

When I run a python project with an oled display on a rasperry pi zero,
it calls for the Minecraftia.ttf font. I have the said file in
home/pi/.fonts/


Do you mean /home/pi/.fonts (with a leading slash, an absolute path
rather than a relative one)?

Dan


Not sure how you mean, but it is just as I typed it, with a forward or
leading slash.
I have it solved now, with a different font.


What he means is that according to the stack trace you were asking for:
home/pi/.fonts/Minecraftia.ttf

instead of
/home/pi/.fonts/Minecraftia.ttf

If you cut and paste the traceback then that is what happened.  Likely
when you tried a different font you added the missing / and all was well.



Yes that is correct, my mistake.

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


[issue38820] Make Python compatible with OpenSSL 3.0.0

2019-12-07 Thread miss-islington


miss-islington  added the comment:


New changeset a197f8aa7493e66bc54c3db8f796d00cef1c3042 by Miss Islington (bot) 
in branch '3.7':
[3.7] bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) (GH-17500)
https://github.com/python/cpython/commit/a197f8aa7493e66bc54c3db8f796d00cef1c3042


--

___
Python tracker 

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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2019-12-07 Thread miss-islington


miss-islington  added the comment:


New changeset 9d3cacd5901f8fbbc4f8b78fc35abad01a0e6546 by Miss Islington (bot) 
in branch '3.8':
[3.8] bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) (GH-17499)
https://github.com/python/cpython/commit/9d3cacd5901f8fbbc4f8b78fc35abad01a0e6546


--

___
Python tracker 

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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2019-12-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16977
pull_request: https://github.com/python/cpython/pull/17499

___
Python tracker 

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



[issue38820] Make Python compatible with OpenSSL 3.0.0

2019-12-07 Thread miss-islington


miss-islington  added the comment:


New changeset 2b7de6696bf2f924cd2cd9ff0a539c8aa37c6244 by Miss Islington (bot) 
(Christian Heimes) in branch 'master':
bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190)
https://github.com/python/cpython/commit/2b7de6696bf2f924cd2cd9ff0a539c8aa37c6244


--
nosy: +miss-islington

___
Python tracker 

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



Re: IOError: cannot open resource

2019-12-07 Thread Michael Torrie
On 12/7/19 9:48 AM, RobH wrote:
> On 07/12/2019 16:00, Dan Sommers wrote:
>> On 12/7/19 9:43 AM, RobH wrote:
>>> When I run a python project with an oled display on a rasperry pi zero,
>>> it calls for the Minecraftia.ttf font. I have the said file in
>>> home/pi/.fonts/
>>
>> Do you mean /home/pi/.fonts (with a leading slash, an absolute path
>> rather than a relative one)?
>>
>> Dan
> 
> Not sure how you mean, but it is just as I typed it, with a forward or 
> leading slash.
> I have it solved now, with a different font.

What he means is that according to the stack trace you were asking for:
   home/pi/.fonts/Minecraftia.ttf

instead of
   /home/pi/.fonts/Minecraftia.ttf

If you cut and paste the traceback then that is what happened.  Likely
when you tried a different font you added the missing / and all was well.

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


[issue38820] Make Python compatible with OpenSSL 3.0.0

2019-12-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16978
pull_request: https://github.com/python/cpython/pull/17500

___
Python tracker 

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



Re: Unicode filenames

2019-12-07 Thread Bob van der Poel
On Sat, Dec 7, 2019 at 4:00 AM Barry Scott  wrote:

>
>
> > On 6 Dec 2019, at 18:17, Bob van der Poel  wrote:
> >
> > I have some files which came off the net with, I'm assuming, unicode
> > characters in the names. I have a very short program which takes the
> > filename and puts into an emacs buffer, and then lets me add information
> to
> > that new file (it's a poor man's DB).
> >
> > Next, I can look up text in the file and open the saved filename.
> > Everything works great until I hit those darn unicode filenames.
>
> Yes the names you download are unicode.
> All OS can save that filename to disk these days.
> Can you see the file on disk with the name you expect?
>
> What OS are you using?
>
> >
> > Just to confuse me even more, the error seems to be coming from a bit of
> > tkinter code:
> > if sresults.has_key(textAtCursor):
> >bookname = os.path.expanduser(sresults[textAtCursor].strip())
> >
> > which generates
> >
> >  UnicodeWarning: Unicode equal comparison failed to convert both
> arguments
> > to Unicode - interpreting them as being unequal  if
> > sresults.has_key(textAtCursor):
>
> What version of python are you using? Peter only managed to get the error
> with python 2.
>
> Do you get the error with python 3?
>
>
I'm running this program on Linux (Ubuntu 19.10) and Python2.

>
>
> > I really don't understand the business about "both arguments". Not sure
> how
> > to proceed here. Hoping for a guideline!
>
>
I've taking the coward's way out and renamed the 1/2 dozen files. Seems
that it is when I grab a filename from the DB it is in unicode and the the
textAtCursor() and then I am trying to open that file using a fork to a
pdf-display program. This is all Q stuff so I'm going to file it under
"mysteries of life" and live with it :)

Thanks all!

-- 

 Listen to my FREE CD at http://www.mellowood.ca/music/cedars 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: b...@mellowood.ca
WWW:   http://www.mellowood.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IOError: cannot open resource

2019-12-07 Thread RobH

On 07/12/2019 16:00, Dan Sommers wrote:

On 12/7/19 9:43 AM, RobH wrote:

When I run a python project with an oled display on a rasperry pi zero,
it calls for the Minecraftia.ttf font. I have the said file in
home/pi/.fonts/


Do you mean /home/pi/.fonts (with a leading slash, an absolute path
rather than a relative one)?

Dan


Not sure how you mean, but it is just as I typed it, with a forward or 
leading slash.

I have it solved now, with a different font.
--
https://mail.python.org/mailman/listinfo/python-list


Re: IOError: cannot open resource

2019-12-07 Thread RobH

On 07/12/2019 16:04, Peter Otten wrote:

RobH wrote:


When I run a python project with an oled display on a rasperry pi zero,
it calls for the Minecraftia.ttf font. I have the said file in
home/pi/.fonts/

I get this error:

pi@raspberrypi:~/Downloads $ python interdisplay.py
Traceback (most recent call last):
File "interdisplay.py", line 220, in 
  display_time()
File "interdisplay.py", line 26, in display_time
  font = ImageFont.truetype('home/pi/.fonts/Minecraftia.ttf', 35)
File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 280,
in truetype
  return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 145,
in __init__
  layout_engine=layout_engine)
IOError: cannot open resource

PILLOW version forked from PIL 1.1.7

I have no idea to what to do about this.


You don't have the font "Minecraftia.ttf". You can either try to find and
install it or replace it with another that you already have in the
/home/pi/.fonts directory.

You may even lie about it, e. g. assuming there is a font called
"NotoSerif-Regular.ttf"

$ cd /home/pi/.fonts
$ ln NotoSerif-Regular.ttf Minecraftia.ttf

should fix the error without making changes to the code.



Thanks for that.
I actually replaced Minecraftia.ttf in the code for 
NotoSerif-Regular.ttf, after I put that font in the .font folder.

It now runs without the above errors.

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


Re: Error getting data from website

2019-12-07 Thread Michael Torrie
On 12/7/19 3:53 AM, Peter Otten wrote:
> 
> ... because Amazon doesn' like what you do. You can cheat or play by their 
> rules and use the API.

Yup and although I have no love for Amazon, I can understand why they
don't want bots on the site. Already they have enough trouble with bots
buying up merchandise that gets resold on the grey market later.  And
also fake reviews.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IOError: cannot open resource

2019-12-07 Thread Dan Sommers

On 12/7/19 9:43 AM, RobH wrote:

When I run a python project with an oled display on a rasperry pi zero,
it calls for the Minecraftia.ttf font. I have the said file in
home/pi/.fonts/


Do you mean /home/pi/.fonts (with a leading slash, an absolute path
rather than a relative one)?

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


Re: IOError: cannot open resource

2019-12-07 Thread Peter Otten
RobH wrote:

> When I run a python project with an oled display on a rasperry pi zero,
> it calls for the Minecraftia.ttf font. I have the said file in
> home/pi/.fonts/
> 
> I get this error:
> 
> pi@raspberrypi:~/Downloads $ python interdisplay.py
> Traceback (most recent call last):
>File "interdisplay.py", line 220, in 
>  display_time()
>File "interdisplay.py", line 26, in display_time
>  font = ImageFont.truetype('home/pi/.fonts/Minecraftia.ttf', 35)
>File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 280,
> in truetype
>  return FreeTypeFont(font, size, index, encoding, layout_engine)
>File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 145,
> in __init__
>  layout_engine=layout_engine)
> IOError: cannot open resource
> 
> PILLOW version forked from PIL 1.1.7
> 
> I have no idea to what to do about this.

You don't have the font "Minecraftia.ttf". You can either try to find and 
install it or replace it with another that you already have in the 
/home/pi/.fonts directory.

You may even lie about it, e. g. assuming there is a font called 
"NotoSerif-Regular.ttf"

$ cd /home/pi/.fonts
$ ln NotoSerif-Regular.ttf Minecraftia.ttf

should fix the error without making changes to the code.

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


[issue38994] Implement __class_getitem__ for PathLike

2019-12-07 Thread Batuhan


Change by Batuhan :


--
keywords: +patch
pull_requests: +16976
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17498

___
Python tracker 

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



[issue38994] Implement __class_getitem__ for PathLike

2019-12-07 Thread Batuhan


New submission from Batuhan :

Typeshed already using __class_getitem__ syntax for PathLike
https://github.com/python/typeshed/search?q=PathLike_q=PathLike

--
components: Library (Lib)
messages: 357978
nosy: BTaskaya, asvetlov
priority: normal
severity: normal
status: open
title: Implement __class_getitem__ for PathLike
versions: Python 3.9

___
Python tracker 

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



[issue38978] Implement __class_getitem__ for Future, Task, Queue

2019-12-07 Thread Batuhan


Batuhan  added the comment:

> I think that applying the same to PathLike makes sense as well, but it 
> deserves another issue.

Yes, it looks like they are using that in typeshed. I'm opening another issue 
with a patch. Thanks for reminding that

--

___
Python tracker 

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



IOError: cannot open resource

2019-12-07 Thread RobH
When I run a python project with an oled display on a rasperry pi zero, 
it calls for the Minecraftia.ttf font. I have the said file in 
home/pi/.fonts/


I get this error:

pi@raspberrypi:~/Downloads $ python interdisplay.py
Traceback (most recent call last):
  File "interdisplay.py", line 220, in 
display_time()
  File "interdisplay.py", line 26, in display_time
font = ImageFont.truetype('home/pi/.fonts/Minecraftia.ttf', 35)
  File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 280, 
in truetype

return FreeTypeFont(font, size, index, encoding, layout_engine)
  File "/usr/lib/python2.7/dist-packages/PIL/ImageFont.py", line 145, 
in __init__

layout_engine=layout_engine)
IOError: cannot open resource

PILLOW version forked from PIL 1.1.7

I have no idea to what to do about this.

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


[issue29636] Specifying indent in the json.tool command

2019-12-07 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 15fb7fa88187f5841088721a43609bffe64a8dc7 by Inada Naoki (Daniel 
Himmelstein) in branch 'master':
bpo-29636: json.tool: Add document for indentation options. (GH-17482)
https://github.com/python/cpython/commit/15fb7fa88187f5841088721a43609bffe64a8dc7


--

___
Python tracker 

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



[issue25160] Stop using deprecated imp module; imp should now emit a real DeprecationWarning

2019-12-07 Thread Batuhan


Batuhan  added the comment:

@vstinner 

> Tools/importbench/importbench.py:10:import imp
> I think that it's fine to keep imp there. 

Any reason to keep imp there? We can just port it to sole importlib (it already 
uses it in some places)

--
nosy: +BTaskaya

___
Python tracker 

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



[issue38993] cProfile behaviour issue with decorator and math.factorial() lib.

2019-12-07 Thread AVicennA


Change by AVicennA :


--
components: Library (Lib)
files: cProfiling.txt
nosy: AvicennA
priority: normal
severity: normal
status: open
title: cProfile behaviour issue with decorator and math.factorial() lib.
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48764/cProfiling.txt

___
Python tracker 

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



Re: Vim settings for Python

2019-12-07 Thread 황병희
Hello Peter^^^

> As an aside, to prevent vim from inserting tabs in the first place, set
> expandtab
> sw=4
> and maybe also
> ts=4
> (The latter is very much a matter of taste. I don't unless I have to
> edit code which already contains tabs intended to be at a certain width.)

Because sometimes, i use vim (Ubuntu 18.04 LTS), so very much thanks^^^

Sincerely,

-- 
^고맙습니다 _地平天成_ 감사합니다_^))//
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-07 Thread Amir Mohamadi


Change by Amir Mohamadi :


--
keywords: +patch
pull_requests: +16975
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17497

___
Python tracker 

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



[issue38652] Remove/update provisional note for asyncio.BufferedProtocol

2019-12-07 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
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



[issue38652] Remove/update provisional note for asyncio.BufferedProtocol

2019-12-07 Thread miss-islington


miss-islington  added the comment:


New changeset 4443450fdaf248427cf4a00a6ee36229e6402ec6 by Miss Islington (bot) 
(Anj-A) in branch 'master':
bpo-38652: Remove provisional note for asyncio.BufferedProtocol (GH-17047)
https://github.com/python/cpython/commit/4443450fdaf248427cf4a00a6ee36229e6402ec6


--
nosy: +miss-islington

___
Python tracker 

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



[issue37404] asyncio sock_recv blocks on ssl sockets.

2019-12-07 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 930cef2770b641f49e69b67840daaa53b65cd0e0 by Andrew Svetlov in 
branch '3.8':
[3.8] bpo-37404: Raising value error if an SSLSocket is passed to asyncio 
functions (GH-16457) (#17496)
https://github.com/python/cpython/commit/930cef2770b641f49e69b67840daaa53b65cd0e0


--

___
Python tracker 

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



Re: ImportError: No module named Adafruit_SSD1306 Update

2019-12-07 Thread Peter J. Holzer
On 2019-12-05 19:30:31 +, Rhodri James wrote:
> On 05/12/2019 18:49, RobH wrote:
> > TabError: inconsistent use of tabs and spaces in indentation
> 
> The problem will be that you have a mix of tabs and spaces in your
> indentation.  This causes problems because some people don't think that the
> One True Tab Width is 8 characters ;-) so to them the indentation looks
> ragged.  Worse, when they mix tabs and spaces, code that looks to be at the
> same indentation level to them looks different to the interpreter.  The
> decision was taken a while ago that Python should put its foot down about
> this, and demand that we use either all tabs or all spaces for our
> indentation.

At least as of Python 3.7, this is not true: You can mix spaces and tabs
in the same line. The mix just has to be consistent between lines. So
for example:

  1 #!/usr/bin/python3
  2 
  3 def f(a, b, c):
  4 if a < b:
  5 »···if b < c:
  6 »···print("x")
  7 »···else:
  8 »···print("y")

(I have configured vim to display a tab as a right guillemet followed by
middle dots and simply pasted that into this message)

produces the error message:

  File "./indent3", line 5
if b < c:
^
TabError: inconsistent use of tabs and spaces in indentation

because depending on the tab width line 5 might be more or less indented
than line 4.

(I don't actually understand the rules here: I constructed a very
similar example before that the same python interpreter accepted.)

However, this works:

  1 #!/usr/bin/python3
  2
  3 def f(a, b, c):
  4 if a < b:
  5 »···if b < c:
  6 »···print("x")
  7 »···else:
  8 »···print("y")


I would recommend to avoid that and stick to either tabs or spaces
(personally, I prefer spaces). You might want to use an editor which
can display tabs specially (like vim).

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +lemburg, mark.dickinson, rhettinger, stutzbach

___
Python tracker 

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



[issue37404] asyncio sock_recv blocks on ssl sockets.

2019-12-07 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue37404] asyncio sock_recv blocks on ssl sockets.

2019-12-07 Thread miss-islington


miss-islington  added the comment:


New changeset a85066df9423d381e6b233469b00db55563a9f80 by Miss Islington (bot) 
in branch '3.7':
bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions 
(GH-16457)
https://github.com/python/cpython/commit/a85066df9423d381e6b233469b00db55563a9f80


--

___
Python tracker 

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



Re: JavaScript Calculator Program

2019-12-07 Thread Chris Angelico
On Sat, Dec 7, 2019 at 11:21 PM ferzan saglam  wrote:
>
> Hi People, I am working on a simple calculator which uses operands (+-*/).
> The program allows me to choose an operand and enter the first two values, 
> but when it gets to doing the maths, it gives me an error on
> "console.log ("The result is ", res);" under the + operand.
> (error code reads: Println is not a function)
>
> Any help will be much appreciated.
> Thanks in advance.

Do your own homework.

You've just posted a JavaScript homework problem to a Python mailing
list. The only help I'm going to give you is to remind you to read
your error messages, because they are there to help you.

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


JavaScript Calculator Program

2019-12-07 Thread ferzan saglam
Hi People, I am working on a simple calculator which uses operands (+-*/).
The program allows me to choose an operand and enter the first two values, but 
when it gets to doing the maths, it gives me an error on 
"console.log ("The result is ", res);" under the + operand.
(error code reads: Println is not a function)

Any help will be much appreciated. 
Thanks in advance.

---

console.log ("1. Add numbers"); 

console.log("2. Subtract numbers"); 

console.log("3. Multiply numbers"); 

console.log("4. Divide numbers");   


console.log = prompt("What's your choice?");


var num1 = prompt("Enter the first number ");   

firstnumber = prompt;   

var num2 = prompt("Enter the second number ");  

secondnumber = prompt;  

var choice; 
var res;

if (choice == 1);   
result = (num1 + num2); 

console.log ("The result is ", res);


if (choice == 2);   
result = (num1 - num2); 

console.log ("The result is = ", res);  


if (choice == 3);   
result = (num1 * num2); 

console.log ("The result is = ", res);  


if (choice == 4);   
result = (num1 / num2); 

console.log ("The result is = ", res);

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


[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-07 Thread Batuhan


Change by Batuhan :


--
nosy: +BTaskaya

___
Python tracker 

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



Re: Unicode filenames

2019-12-07 Thread Barry Scott



> On 6 Dec 2019, at 18:17, Bob van der Poel  wrote:
> 
> I have some files which came off the net with, I'm assuming, unicode
> characters in the names. I have a very short program which takes the
> filename and puts into an emacs buffer, and then lets me add information to
> that new file (it's a poor man's DB).
> 
> Next, I can look up text in the file and open the saved filename.
> Everything works great until I hit those darn unicode filenames.

Yes the names you download are unicode.
All OS can save that filename to disk these days.
Can you see the file on disk with the name you expect?

What OS are you using? 

> 
> Just to confuse me even more, the error seems to be coming from a bit of
> tkinter code:
> if sresults.has_key(textAtCursor):
>bookname = os.path.expanduser(sresults[textAtCursor].strip())
> 
> which generates
> 
>  UnicodeWarning: Unicode equal comparison failed to convert both arguments
> to Unicode - interpreting them as being unequal  if
> sresults.has_key(textAtCursor):

What version of python are you using? Peter only managed to get the error
with python 2. 

Do you get the error with python 3?

Barry


> I really don't understand the business about "both arguments". Not sure how
> to proceed here. Hoping for a guideline!
> 
> Thanks.
> 
> 
> -- 
> 
>  Listen to my FREE CD at http://www.mellowood.ca/music/cedars 
> Bob van der Poel ** Wynndel, British Columbia, CANADA **
> EMAIL: b...@mellowood.ca
> WWW:   http://www.mellowood.ca
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


[issue37404] asyncio sock_recv blocks on ssl sockets.

2019-12-07 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +16974
pull_request: https://github.com/python/cpython/pull/17496

___
Python tracker 

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



[issue37404] asyncio sock_recv blocks on ssl sockets.

2019-12-07 Thread miss-islington


miss-islington  added the comment:


New changeset 892f9e0777f262d366d4747a54c33a1c15a49da6 by Miss Islington (bot) 
(idomic) in branch 'master':
 bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions 
(GH-16457)
https://github.com/python/cpython/commit/892f9e0777f262d366d4747a54c33a1c15a49da6


--
nosy: +miss-islington

___
Python tracker 

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



[issue37404] asyncio sock_recv blocks on ssl sockets.

2019-12-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16973
pull_request: https://github.com/python/cpython/pull/17495

___
Python tracker 

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



[issue38986] Suppport TaskWakeupMethWrapper.__self__ to conform asyncio _format_handle logic

2019-12-07 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
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



Re: Zipapp can't find sqlite db

2019-12-07 Thread Barry Scott



> On 7 Dec 2019, at 10:07, dieter  wrote:
> 
> Abdur-Rahmaan Janhangeer  writes:
>> I'm using zipapp to include a gui + db
>> 
>> __main__.py
>> dbs/
>>file.db
>> 
>> When packaging, the db is there. When querying through sqlalchemy, it says
>> can't open db file. Help appreciated!
> 
> I am unsure what you mean with "packaging". If you mean
> "create a package for PyPI management", then data files
> (unlike Python source code files) need special treatment.
> In this case, read the documentation for your packageing tool.


zipapp is part of the python standard library.

The docs only talk about packaging pure python code, not data files.

Barry

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


[issue38529] Python 3.8 improperly warns about closing properly closed streams

2019-12-07 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
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



[issue38529] Python 3.8 improperly warns about closing properly closed streams

2019-12-07 Thread miss-islington


miss-islington  added the comment:


New changeset 7fde4f446a3dcfed780a38fbfcd7c0b4d9d73b93 by Miss Islington (bot) 
in branch '3.8':
bpo-38529: Fix asyncio stream warning (GH-17474)
https://github.com/python/cpython/commit/7fde4f446a3dcfed780a38fbfcd7c0b4d9d73b93


--
nosy: +miss-islington

___
Python tracker 

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



[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-07 Thread Xavier de Gaye


Change by Xavier de Gaye :


Added file: https://bugs.python.org/file48763/foo.arm64

___
Python tracker 

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



[issue38992] testFsum failure caused by constant folding of a float expression

2019-12-07 Thread Xavier de Gaye


New submission from Xavier de Gaye :

Title: testFsum failure caused by constant folding of a float expression

Description:

Python (Python 3.9.0a1+ heads/master-dirty:ea9835c5d1) is built on a Linux 
x86_64. This native interpreter is used to cross-compile Python (using the same 
source) to Android API 24. Next the installation is done locally to DESTDIR by 
running 'make install' with the env var DESTDIR set and the standard library 
modules are compiled by the native interpreter during this process.  The 
content of DESTDIR is then copied to an arm64 android device (Huawei FWIW). The 
test_math.MathTests.testFsum test fails on the android device with:

AssertionError: -4.309103330548428e+214 != -1.0

This occurs when testing '([1.7**(i+1)-1.7**i for i in range(1000)] + 
[-1.7**1000], -1.0)' in test_values.

Next the test_math.py file is touched on the android device to force 
recompilation of the module and testFsum becomes surprisingly successful.

Investigation:
--
The hexadecimal representation of 1.7**n on x86_64 and arm64 are:
* different for n in (10, 100, 1000)
* equal for n in [0, 9] or 11

on x86_64:
>>> 1.7**10
201.59939004489993
>>> (1.7**10).hex()
'0x1.9332e34080c95p+7'

on arm64:
>>> 1.7**10
201.59939004489996
>>> (1.7**10).hex()
'0x1.9332e34080c96p+7'

The output of the following foo.py module that has been run on x86_64 and arm64 
are attached to this issue:

###
import math, dis

def test_fsum():
x = [1.7**(i+1)-1.7**i for i in range(10)] + [-1.7**10]
return x

y = test_fsum()
print(y)
print(math.fsum(y))
dis.dis(test_fsum)
###

The only difference between both dissasembly of test_fsum() is at bytecode 16 
that loads the folded constant 1.7**10.

Conclusion:
---
The compilation of the expression '[1.7**(i+1)-1.7**i for i in range(1000)] + 
[-1.7**1000]' on x86_64 folds '1.7**1000' to 2.8113918290273277e+230 When the 
list comprehension (the first term of the expression) is executed on arm64, 
then 1.7**1000 is evaluated as 2.8113918290273273e+230.  On arm64 1.7**1000 - 
2.8113918290273277e+230 = -4.309103330548428e+214, hence the AssertionError 
above.

This is confirmed by changing testFsum to prevent constant folding by replacing 
1000 in the testFsum expression with a variable whose value is 1000.  In that 
case the test_math module compiled on x86_64 is successful on arm64. This could 
be a fix for this issue unless this fix would be hiding another problem such as 
.pyc files portability across different platforms and my knowledge of IEEE 754 
is too superficial to answer that point.

--
components: Tests
files: foo.x86_64
messages: 357969
nosy: tim.peters, vstinner, xdegaye
priority: normal
severity: normal
stage: needs patch
status: open
title: testFsum failure caused by constant folding of a float expression
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file48762/foo.x86_64

___
Python tracker 

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



[issue38986] Suppport TaskWakeupMethWrapper.__self__ to conform asyncio _format_handle logic

2019-12-07 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +16972
pull_request: https://github.com/python/cpython/pull/17494

___
Python tracker 

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



Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-07 Thread Peter J. Holzer
On 2019-12-02 09:55:16 -0800, Rob Gaddi wrote:
> The struct situation is, as you said, a bit different.  I believe that with
> the default native alignment @, you're seeing 4-byte data padded to an
> 8-byte alignment, not 8-byte data.

Nope. That's really an 8 byte long:

Python 3.7.3 (default, Apr  3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct

>>> struct.pack('L', 0x0807060504030201)
b'\x01\x02\x03\x04\x05\x06\x07\x08'

All 8 bytes are serialized. Trying to serialize 9 bytes (actually only 68
non-zero bits) fails:

>>> struct.pack('L', 0x090807060504030201)
Traceback (most recent call last):
  File "", line 1, in 
struct.error: argument out of range

And when you use the "standard size", 8 bytes are also too much:

>>> struct.pack('=L', 0x0807060504030201)
Traceback (most recent call last):
  File "", line 1, in 
struct.error: 'L' format requires 0 <= number <= 4294967295

But 4 bytes are ok:
>>> struct.pack('=L', 0x04030201)
b'\x01\x02\x03\x04'


hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38986] Suppport TaskWakeupMethWrapper.__self__ to conform asyncio _format_handle logic

2019-12-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16971
pull_request: https://github.com/python/cpython/pull/17493

___
Python tracker 

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



[issue38529] Python 3.8 improperly warns about closing properly closed streams

2019-12-07 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 7ddcd0caa4c2e6b43265df144f59c5aa508a94f2 by Andrew Svetlov in 
branch 'master':
bpo-38529: Fix asyncio stream warning (GH-17474)
https://github.com/python/cpython/commit/7ddcd0caa4c2e6b43265df144f59c5aa508a94f2


--

___
Python tracker 

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



Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-07 Thread Peter J. Holzer
On 2019-12-05 09:27:43 +, Barry Scott wrote:
> On 3 Dec 2019, at 01:50, Richard Damon  wrote:
> > On 12/2/19 4:25 PM, Barry Scott wrote:
> > x=struct.pack('L',0x102030405)
> > x
> >> b'\x05\x04\x03\x02\x01\x00\x00\x00'
> >> 
> >> Given I have exact control with b, h, i, and q but L is not fixed
> >> in size I'm not sure how it can be used with certainty across OS
> >> and versions.
> >> 
> >> Barry
> >> 
> > Actually, you DON'T have exact control with those sizes, it just happens
> > that all the platforms you are using happen to have the same size for
> > those types.
> 
> According to the docs for struct (python 2.7 and python 3.8) I do have
> exact control for the types I listed.

You also have exact control over the size of the 'L' type.

But only if you use the prefixes with a standard size (see the table in
https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment),
not with "@" (which is the default). 

This is also true for the other sizes. A platform where short is 32 bits
or int is 64 bits might exist (in fact I've used the former (not with
Python, though), and while I've never used the latter, I've certainly
heard of one machine where that was the case (the Cray was quite famous
in its time)).

When you are reading and writing files which "can be used with certainty
across OS and versions" you need to use one of the prefixes "<", ">" or
"!" anyway because you also want to control the byte order, not just the
size (although big-endian architectures may be history in a few years).

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38529] Python 3.8 improperly warns about closing properly closed streams

2019-12-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16970
pull_request: https://github.com/python/cpython/pull/17492

___
Python tracker 

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



[issue38978] Implement __class_getitem__ for Future, Task, Queue

2019-12-07 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Done.
I think that applying the same to PathLike makes sense as well, but it deserves 
another issue.

--

___
Python tracker 

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



[issue38978] Implement __class_getitem__ for Future, Task, Queue

2019-12-07 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Thanks, Batuhan!

--

___
Python tracker 

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



[issue38978] Implement __class_getitem__ for Future, Task, Queue

2019-12-07 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
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



[issue38978] Implement __class_getitem__ for Future, Task, Queue

2019-12-07 Thread miss-islington

miss-islington  added the comment:


New changeset dec367261e7e2bb4dd42feeb58031abed2ade683 by Miss Islington (bot) 
(Batuhan Taşkaya) in branch 'master':
bpo-38978: Implement __class_getitem__ for asyncio objects (GH-17491)
https://github.com/python/cpython/commit/dec367261e7e2bb4dd42feeb58031abed2ade683


--
nosy: +miss-islington

___
Python tracker 

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



Re: Error getting data from website

2019-12-07 Thread Peter Otten
Michael Torrie wrote:

> On 12/6/19 5:31 PM, DL Neil via Python-list wrote:
>> If you read the HTML data that the REPL has happily splattered all over
>> your terminal's screen (scroll back) (NB "soup" is easier to read than
>> is "content"!) you will observe that what you saw in your web-browser is
>> not what Amazon served in response to the Python "requests.get()"!
> 
> Sadly it's likely that Amazon's page is largely built from javascript.

That's not the problem here. Quoting the html returned by

requests.get("https://www.amazon.ca/dp/B07RZFQ6HC;)

"""
To discuss automated access to Amazon data please contact api-services-
supp...@amazon.com.
"""

If you retrieve the page manually:

$ wget "https://www.amazon.ca/dp/B07RZFQ6HC; -O tmp.gz
[...]
2019-12-07 11:47:03 (80,6 KB/s) - »tmp.gz« gespeichert [115426]

$ gunzip tmp.gz
$ python3
[...]
Type "help", "copyright", "credits" or "license" for more information.
>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup(open("tmp").read())
>>> soup.find("span", dict(id="priceblock_dealprice")
... )
CDN$ 1,019.00
>>> _.text
'CDN$\xa01,019.00'

> So scraping static html is probably not going to get you where you want
> to go.  

... because Amazon doesn' like what you do. You can cheat or play by their 
rules and use the API.

> There are heavier tools, such as Selenium that uses a real
> browser to grab a page, and the result of that you can parse and search
> perhaps.



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


[issue38978] Implement __class_getitem__ for Future, Task, Queue

2019-12-07 Thread Batuhan


Change by Batuhan :


--
keywords: +patch
pull_requests: +16969
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17491

___
Python tracker 

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



Re: Vim settings for Python (was: tab replace to space 4)

2019-12-07 Thread Bev In TX

> On Dec 7, 2019, at 4:16 AM, Peter J. Holzer  wrote:
> 
> As an aside, to prevent vim from inserting tabs in the first place, set
>expandtab
>sw=4
> and maybe also
>ts=4
> (The latter is very much a matter of taste. I don't unless I have to
> edit code which already contains tabs intended to be at a certain width.)

I’m not the OP, but I do appreciate this info.  Thanks!
Bev in TX
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-07 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I think it should look like the corresponding function from multidict: 
https://github.com/aio-libs/multidict/blob/master/multidict/_multidict.c#L803-L808

Please note, the method definition also should be updated, see 
https://github.com/aio-libs/multidict/blob/master/multidict/_multidict.c#L923-L928
 for inspiration.

--

___
Python tracker 

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



Vim settings for Python (was: tab replace to space 4)

2019-12-07 Thread Peter J. Holzer
On 2019-11-29 13:46:38 +0900, 황병희 wrote:
> usally i write python code in gnu emacs on ubuntu 18.04 sometimes i
> re-edit the code vim in same machine so often when i do run the code in
> shell like as ./test.py i meet consol error -- which line wrong!
> 
> so i am considering how can i replace all tab to space 4 within python

As an aside, to prevent vim from inserting tabs in the first place, set
expandtab
sw=4
and maybe also
ts=4
(The latter is very much a matter of taste. I don't unless I have to
edit code which already contains tabs intended to be at a certain width.)

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Zipapp can't find sqlite db

2019-12-07 Thread dieter
Abdur-Rahmaan Janhangeer  writes:
> I'm using zipapp to include a gui + db
>
> __main__.py
> dbs/
> file.db
>
> When packaging, the db is there. When querying through sqlalchemy, it says
> can't open db file. Help appreciated!

I am unsure what you mean with "packaging". If you mean
"create a package for PyPI management", then data files
(unlike Python source code files) need special treatment.
In this case, read the documentation for your packageing tool.

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


[issue35048] Can't reassign __class__ despite the assigned class having identical slots

2019-12-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue35048] Can't reassign __class__ despite the assigned class having identical slots

2019-12-07 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue38981] better name for re.error Exception class.

2019-12-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +easy

___
Python tracker 

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



[issue9529] Make re match object iterable

2019-12-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch -easy
resolution:  -> rejected
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



Re: Unicode filenames

2019-12-07 Thread Peter Otten
Bob van der Poel wrote:

> I have some files which came off the net with, I'm assuming, unicode
> characters in the names. I have a very short program which takes the
> filename and puts into an emacs buffer, and then lets me add information
> to that new file (it's a poor man's DB).
> 
> Next, I can look up text in the file and open the saved filename.
> Everything works great until I hit those darn unicode filenames.
> 
> Just to confuse me even more, the error seems to be coming from a bit of
> tkinter code:
>  if sresults.has_key(textAtCursor):
> bookname = os.path.expanduser(sresults[textAtCursor].strip())
> 
> which generates
> 
>   UnicodeWarning: Unicode equal comparison failed to convert both
>   arguments
> to Unicode - interpreting them as being unequal  if
> sresults.has_key(textAtCursor):
> 
> I really don't understand the business about "both arguments". Not sure
> how to proceed here. Hoping for a guideline!

I cannot provoke the error with dict.has_key() over here, only with direct 
comparisons:

>>> u"a" == u"ä"
False
>>> u"a" == "ä"
__main__:1: UnicodeWarning: Unicode equal comparison failed to convert both 
arguments to Unicode - interpreting them as being unequal
False

The problem is that you are mixing strings of type str and type unicode, and 
generally speaking the remedy is to use unicode throughout. In your case
this means opening files with io.open() or codecs.open() instead of the 
builtin, and invoking os.listdir() with a unicode argument.

I don't remember about Tkinter, I think it provides ascii-only strings as 
str and everything else as unicode. If that's correct you could play it safe 
with a conversion function:

def ensure_unicode(s):
if isinstance(s, bytes):
return s.decode("ascii")
return s

Your other option is to live with the *warning* -- it's not an error, just a 
reminder that you have to rethink your types once you switch to Python 3.

You can also switch off the message with

python -W ignore::UnicodeWarning yourscript

or by setting the PYTHONWARNINGS environment variable.


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


[issue38979] ContextVar[str] should return ContextVar class, not None

2019-12-07 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

@asvetlov I have a question! Should "contextvar_cls_getitem" function be 
changed? And can you please help me figure out how to change it?

--
nosy: +Amir -DahlitzFlorian, gvanrossum, levkivskyi, yselivanov

___
Python tracker 

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