[issue41124] String with encode causing addition of 'b' in the beginning

2020-06-25 Thread Srinivas Sampath


Srinivas Sampath  added the comment:

if you look at my code, couple of lines below the print, i am actually
doing the send over the socket.  It took me awhile to figure out why the
socket is failing.  I understand that the byte array is represented with a
'b' infront as part of encode function being called, and troubleshooting
the code it was the first obvious difference that made me thing it was an
issue.

Thanks for your help

On Thu, Jun 25, 2020 at 10:37 PM SilentGhost  wrote:

>
> SilentGhost  added the comment:
>
> Your request is likely failing for entirely different reasons.
>
> What you've done is encoded a str object into bytes object, which is
> represented with as literal using b prefix. It isn't being sent over the
> socket.
>
> --
> nosy: +SilentGhost
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

-- 
With Regards,

Srinivas Sampath

--

___
Python tracker 

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



[issue41111] Convert a few stdlib extensions to the limited C API

2020-06-25 Thread SilentGhost


Change by SilentGhost :


Removed file: 
https://bugs.python.org/file49263/Whatsapp-self-message-delivering-using-python-c55344b7f384e036bbe0fda69918c9eccf146dc1.zip

___
Python tracker 

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



[issue41124] String with encode causing addition of 'b' in the beginning

2020-06-25 Thread SilentGhost


SilentGhost  added the comment:

Your request is likely failing for entirely different reasons.

What you've done is encoded a str object into bytes object, which is 
represented with as literal using b prefix. It isn't being sent over the socket.

--
nosy: +SilentGhost
resolution:  -> not a bug
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



[issue41125] Display exit-codes for abruptly terminated processes in concurrent.futures

2020-06-25 Thread Laurie Opperman


New submission from Laurie Opperman :

When a process terminates in the process-pool of concurrent.futures.process, it 
simply gives the exception (with no __cause__):

BrokenProcessPool: A process in the process pool was terminated abruptly 
while the future was running or pending.

I would like to include the terminated processes' exit codes in the error, 
either as part of the message or as a separate exception set as the error's 
__cause__

--
components: Library (Lib)
messages: 372409
nosy: Epic_Wink
priority: normal
severity: normal
status: open
title: Display exit-codes for abruptly terminated processes in 
concurrent.futures
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue41124] String with encode causing addition of 'b' in the beginning

2020-06-25 Thread Srinivas Sampath


New submission from Srinivas Sampath :

I am trying to run the attached code.  when hard-coding the string in the URL 
and doing .encode, then the code works.  However since i am requesting user 
input, i cannot hard-code and the code seem to add the 'b' character in the 
beginning causing the request to fail with output like this

Enter Hostname:
hostname cannot be empty
Enter Port Number :
before invokingGET http://psglx73:24670/coreservices/DomainService HTTP/1.1


after encode
b'GET http://psglx73:24670/coreservices/DomainService HTTP/1.1\r\n\r\n'
HTTP/1.1 400 Bad Request
Transfer-Encoding: chunked
Date: Fri, 26 Jun 2020 05:06:21 GMT
Connection: close
Server: Informatica

0

i cannot pass without .encode to the socket communication.  is this reported 
problem ?

--
files: ex_12_informatica.py
messages: 372408
nosy: Srinivas Sampath
priority: normal
severity: normal
status: open
title: String with encode causing addition of 'b' in the beginning
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49264/ex_12_informatica.py

___
Python tracker 

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



[issue41123] Remove Py_UNICODE APIs except PEP 623

2020-06-25 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue41123] Remove Py_UNICODE APIs except PEP 623

2020-06-25 Thread Inada Naoki


New submission from Inada Naoki :

# APIs relating to wstr

Since some APIs did not have Py_DEPRECATE until 3.9 (see GH-20941), it can not 
be removed in 3.10. I wrote PEP 623 for them.

This issue doesn't about them.


# Deprecated since Python 3.3, and not documented.

In Python 3.3 what's new:

* :c:macro:`Py_UNICODE_strlen`: use :c:func:`PyUnicode_GetLength` or
  :c:macro:`PyUnicode_GET_LENGTH`
* :c:macro:`Py_UNICODE_strcat`: use :c:func:`PyUnicode_CopyCharacters` or
  :c:func:`PyUnicode_FromFormat`
* :c:macro:`Py_UNICODE_strcpy`, :c:macro:`Py_UNICODE_strncpy`,
  :c:macro:`Py_UNICODE_COPY`: use :c:func:`PyUnicode_CopyCharacters` or
  :c:func:`PyUnicode_Substring`
* :c:macro:`Py_UNICODE_strcmp`: use :c:func:`PyUnicode_Compare`
* :c:macro:`Py_UNICODE_strncmp`: use :c:func:`PyUnicode_Tailmatch`
* :c:macro:`Py_UNICODE_strchr`, :c:macro:`Py_UNICODE_strrchr`: use
  :c:func:`PyUnicode_FindChar`

These functions are not documented.  But they has Py_DEPRECATED(3.3) from 
Python 3.6.
Let's remove them in 3.10.


# Deprecated since Python 3.3 with document

Some APIs has document with `.. deprecated:: 3.3 4.0`.

* PyLong_FromUnicode
* PyUnicode_TransformDecimalToASCII
* PyUnicode_AsUnicodeCopy
* PyUnicode_Encode
* PyUnicode_EncodeUTF7
* PyUnicode_EncodeUTF8
* PyUnicode_EncodeUTF16
* PyUnicode_EncodeUTF32
* PyUnicode_EncodeUnicodeEscape
* PyUnicode_EncodeRawUnicodeEscape
* PyUnicode_EncodeLatin1
* PyUnicode_EncodeASCII
* PyUnicode_EncodeCharmap
* PyUnicode_TranslateCharmap
* PyUnicode_EncodeMBCS


a) Can we replace 4.0 with 3.10 and remove them in 3.10?
b) Or should we replace 4.0 with 3.11 and wait one more year?

--
components: C API
messages: 372407
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Remove Py_UNICODE APIs except PEP 623
versions: Python 3.10

___
Python tracker 

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



[issue41122] functools.singledispatchfunction has confusing error message if no positional arguments are passed in

2020-06-25 Thread Mark Grandi


Change by Mark Grandi :


--
title: functools.singledispatchfunction has confusing error message if no 
position arguments are passed in -> functools.singledispatchfunction has 
confusing error message if no positional arguments are passed in

___
Python tracker 

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



[issue41122] functools.singledispatchfunction has confusing error message if no position arguments are passed in

2020-06-25 Thread Mark Grandi


New submission from Mark Grandi :

this is with python 3.8:

```plaintext
PS C:\Users\mark> py -3 --version --version
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit 
(AMD64)]
```

So when using functools.singledispatch or functools.singledispatchmethod, you 
need to provide at least 1 positional argument so it can dispatch based on the 
type of said argument

however, with `functools.singledispatchmethod`, you get an error message that 
is confusing and not obvious what the problem is.

Example with `functools.singledispatchmethod`: 

```
class NegatorTwo:
@singledispatchmethod
def neg(arg):
raise NotImplementedError("Cannot negate a")

@neg.register
def _(self, arg: int):
return -arg

@neg.register
def _test(self, arg: bool):
return not arg


if __name__ == "__main__":

n = NegatorTwo()
print(n.neg(0))
print(n.neg(False))
print(n.neg(arg=0))

```

you end up getting: 

```plaintext
PS C:\Users\mark> py -3 C:\Users\mark\Temp\singledisp.py
0
True
Traceback (most recent call last):
  File "C:\Users\mark\Temp\singledisp.py", line 58, in 
print(n.neg(arg=0))
  File "C:\Python38\lib\functools.py", line 910, in _method
method = self.dispatcher.dispatch(args[0].__class__)
IndexError: tuple index out of range

```


but with just regular `functools.singledispatch`:


```plaintext

@functools.singledispatch
def negate_func(arg):
raise NotImplementedError("can't negate")

@negate_func.register
def negate_int_func(arg:int):
return -arg

@negate_func.register
def negate_bool_func(arg:bool):
return not arg


if __name__ == "__main__":


print(negate_func(0))
print(negate_func(False))
print(negate_func(arg=0))

```

you get an error that tells you what actually is wrong:

```plaintext

PS C:\Users\mark> py -3 C:\Users\mark\Temp\singledisp.py
0
True
Traceback (most recent call last):
  File "C:\Users\mark\Temp\singledisp.py", line 63, in 
print(negate_func(arg=0))
  File "C:\Python38\lib\functools.py", line 871, in wrapper
raise TypeError(f'{funcname} requires at least '
TypeError: negate_func requires at least 1 positional argument

```

it seems that the code in `functools.singledispatchmethod` needs to check to 
see if `args` is empty, and throw a similar (if not the same) exception as 
`functools.singledispatch`

--
components: Library (Lib)
messages: 372406
nosy: markgrandi
priority: normal
severity: normal
status: open
title: functools.singledispatchfunction has confusing error message if no 
position arguments are passed in
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



[issue39679] functools: singledispatchmethod doesn't work with classmethod

2020-06-25 Thread Mark Grandi


Mark Grandi  added the comment:

same issue here, if we can't fix it then maybe we should edit the documentation 
to not suggest that @classmethod works?

--
nosy: +markgrandi

___
Python tracker 

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



[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-25 Thread Eryk Sun


Eryk Sun  added the comment:

> What it also means is that the "file still in use by another app"
> scenario will probably have to manually use os.stat(). We can't 
> detect it, and it's the same race condition as calling os.stat() 
> shortly before the update flushes anyway.

FAT filesystems require an fsync (FlushFileBuffers) or close on the in-use file 
in order to update the last-write time in both the directory entry and the file 
control block (i.e. FCB, which is shared by all opens). It seems the developers 
take the meaning of "last write" literally in terms of the last time that 
cached data was flushed to disk. Because the last-write time in the FCB is 
updated separately from the file size in the FCB, even an [l]stat on an in-use 
FAT file may see st_size change while st_mtime remains constant, as I showed in 
the previous post. No matter whether we query the directory or the FCB, the 
reported last-write time of a FAT file might be wrong from the standpoint of 
reasonable expectations.

An fsync call is also useful with NTFS, but it only updates the directory entry 
of the opened link. It doesn't update other links to the file. On the other 
hand, with an NTFS file, calling os.[l]stat or os.fstat is sufficient to get 
updated stat information, regardless of the link that's accessed.

> What this probably means is if we can detect a link from the FFD struct
> (which I think we can?) then we can cache the attributes we trust and
> send .stat() through the real call.

It would nice if we could detect the link count without an additional system 
call. But it's not in the duplicated information in the directory entry and 
wouldn't be reliable if it were. The link count is available via 
GetFileInformationByHandleEx: FileStandardInfo, but if you're calling 
CreateFileW to open the file, you may as well get the full stat result while 
you're at it.

We're faced with the choice between either always calling the real lstat, or 
just documenting that files with hard links will have stale information if the 
file was updated using another link.

--

___
Python tracker 

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



[issue41099] Deprecating PyUnicodeTranslateError_Create

2020-06-25 Thread Inada Naoki


Inada Naoki  added the comment:

I added deprecated directive in GH-21162.

--

___
Python tracker 

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



[issue41098] Deprecating PyUnicodeEncodeError_Create

2020-06-25 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

oops, I didn't see. Thanks

--

___
Python tracker 

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



[issue41099] Deprecating PyUnicodeTranslateError_Create

2020-06-25 Thread Inada Naoki


Inada Naoki  added the comment:

I prefer `PyObject_CallFunction(PyExc_UnicodeTranslateError, ...)` because  
UnicodeTranslateError is not so popular for third party libraries.
I don't think we should provide public stable API for convenient.

--

___
Python tracker 

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



[issue41098] Deprecating PyUnicodeEncodeError_Create

2020-06-25 Thread Inada Naoki


Inada Naoki  added the comment:

See #41099 for PyUnicodeTranslateError_Create.

--

___
Python tracker 

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



[issue41098] Deprecating PyUnicodeEncodeError_Create

2020-06-25 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Yes, IMO in docs must exist a deprecated directive entry for 
`PyUnicodeEncodeError_Create`.

Is the same situation with `PyUnicodeTranslateError_Create`, isn't?

--

___
Python tracker 

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



[issue41098] Deprecating PyUnicodeEncodeError_Create

2020-06-25 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu

___
Python tracker 

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



[issue41121] Path sep. in IDLE on Windows changes

2020-06-25 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This complaint is way too vague to work with.  And for anything specific, it is 
almost certainly misdirected as the behavior is almost certainly not an IDLE 
issue.  If your code, which is executed by python, not by IDLE, prints a path, 
IDLE displays it as is, which should be the same as printed by the same code 
executed directly by python.exe, without IDLE involved.  If IDLE displays a 
path as a result of other user actions, it displays the strings returned by 
os.path, or maybe someday by pathlib.

If you have specific complaints about the behavior of os.path, pathlib, or 
other stdlib functions, you could open a new issue.  But I strongly suggest 
posting to python-list first, as these functions are mostly old and their 
well-discussed behavior unlikely to be seen as a bug by the developers who 
maintain them.

If after posting to python-list (which I read), there appears to be a specific 
issue with IDLE, this could be re-opened.

--
resolution:  -> not a bug
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



[issue41120] Possible performance improvement for itertools.product example on Python Docs

2020-06-25 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Thanks for the suggestion, but the purpose of the rough equivalent example is 
to give a better idea of what product() does.  It is not about performance — 
that job falls to the actual implementation.

Nested generators are an intermediate level Python skill, so using them in the 
example code makes the docs less accessible.

--
resolution:  -> rejected
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



[issue41111] Convert a few stdlib extensions to the limited C API

2020-06-25 Thread One Digi Print


Change by One Digi Print :


Added file: 
https://bugs.python.org/file49263/Whatsapp-self-message-delivering-using-python-c55344b7f384e036bbe0fda69918c9eccf146dc1.zip

___
Python tracker 

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



[issue41111] Convert a few stdlib extensions to the limited C API

2020-06-25 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue41118] datetime object does not preserve POSIX timestamp

2020-06-25 Thread Paul Ganssle


Paul Ganssle  added the comment:

There's a pretty clear warning on the documentation that utcfromtimestamp is 
unsuitable for this purpose: 
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp

What you want is a datetime that knows what time zone it's in, so that it can 
be translated back into the absolute number of seconds since UTC. The correct 
way to do that is to tell the datetime it's in UTC by attaching the 
`datetime.timezone.utc` object (or any equivalent `tzinfo`).

I have written a blog post explaining in detail why you should not use `utcnow` 
or `utcfromtimestamp`: https://blog.ganssle.io/articles/2019/11/utcnow.html

Hopefully that is helpful to you.

--
resolution:  -> not a bug
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



[issue41121] Path sep. in IDLE on Windows changes

2020-06-25 Thread wyz23x2


New submission from wyz23x2 :

Python supports "/" and "\" separators on Windows.
So in IDLE, the path shown sometimes is:
D:\xxx\xxx
Sometimes is:
D:/xxx/xxx

That isn't right.

--
assignee: terry.reedy
components: IDLE
messages: 372395
nosy: terry.reedy, wyz23x2
priority: normal
severity: normal
status: open
title: Path sep. in IDLE on Windows changes
type: behavior
versions: Python 3.10, Python 3.7, 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



[issue41118] datetime object does not preserve POSIX timestamp

2020-06-25 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

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



[issue41120] Possible performance improvement for itertools.product example on Python Docs

2020-06-25 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



Re: I need to study Python

2020-06-25 Thread Igor Korot
Hi,
Just sign-up for a local community college.
Will be easier and u will keep motivation...

Thank you.


On Thu, Jun 25, 2020, 6:49 PM  wrote:

> Hey, I'm a completely noob.
> I want to learn python, how can i or where can i study python?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


I need to study Python

2020-06-25 Thread sinanpv22
Hey, I'm a completely noob.
I want to learn python, how can i or where can i study python?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] asyncio: return from multiple coroutines

2020-06-25 Thread Kyle Stanley
(Resending this email since it didn't originally go through to
python-list, sorry for the duplicate Pablo)

> Yes, I want to have multiple results: the connections listening forever, 
> returning a result for each message received.

> I forgot to mention thatI did try to use asyncio.wait with `FIRST_COMPLETED`; 
> however, the problem is that it seems to evict the not-completed coroutines, 
> so the messenger that arrives second does not send the message. To check it, 
> I have run that script without the random sleep. just msgr1 waits 1s and 
> msgr2 waits 2s, so msgr1 always ends first. I expect a result like this 
> (which I am currently getting with queues):

FYI, the other coroutines are not evicted or cancelled, they are
simply in the "pending" set of the "done, pending" tuple returned by
`asyncio.wait()` and were not returned. I misunderstood what you were
actually looking for, but I think that I understand now.

Since it seems like you want to be able to receive the results out of
order from both "messengers" and have them continuously listen to
their respective socket (without affecting the other), a queue is
likely going to be the best approach. I think you had the right
general idea with your example, but here's a way to make it
significantly less cumbersome and easy to expand upon (such as
expanding the number of websockets to listen to):

```
import asyncio

class MessengerQueue:
def __init__(self):
self._queue = asyncio.Queue()

async def get(self):
return await self._queue.get()

async def start_messengers(self):
# Could be easily modified to create any number of
"messengers" set to
# listen on specific websockets, by passing a list and
creating a task for
# each one.
asyncio.create_task(self._messenger("Messenger 1", 1))
asyncio.create_task(self._messender("Messenger 2", 2))

async def _messenger(self, message: str, sleep_time: int):
while True:
await asyncio.sleep(sleep_time)
await self._queue.put(f'{message} awaited for {sleep_time:.2f}s')


async def main():
mqueue = MessengerQueue()
asyncio.create_task(mqueue.start_messengers())
while True:
result = await mqueue.get()
print(result)

asyncio.run(main())
```

This results in your desired output:
Messenger 1 awaited for 1.00s
Messenger 2 awaited for 2.00s
Messenger 1 awaited for 1.00s
Messenger 1 awaited for 1.00s
Messenger 2 awaited for 2.00s
Messenger 1 awaited for 1.00s
Messenger 1 awaited for 1.00s
Messenger 2 awaited for 2.00s

Note: it would probably be more idiomatic to call these "consumers" or
"listeners" rather than "messengers"/"messagers" (the websocket docs
refer to them as "consumer handlers"), but I used "messengers" to make
it a bit more easily comparable to the original queue example from the
OP: https://pastebin.com/BzaxRbtF.

I hope the above example is of some use. :-)

Regards,
Kyle Stanley

On Thu, Jun 25, 2020 at 1:28 AM Kyle Stanley  wrote:
>
> > Yes, I want to have multiple results: the connections listening forever, 
> > returning a result for each message received.
>
> > I forgot to mention thatI did try to use asyncio.wait with 
> > `FIRST_COMPLETED`; however, the problem is that it seems to evict the 
> > not-completed coroutines, so the messenger that arrives second does not 
> > send the message. To check it, I have run that script without the random 
> > sleep. just msgr1 waits 1s and msgr2 waits 2s, so msgr1 always ends first. 
> > I expect a result like this (which I am currently getting with queues):
>
> FYI, the other coroutines are not evicted or cancelled, they are
> simply in the "pending" set of the "done, pending" tuple returned by
> `asyncio.wait()` and were not returned. I misunderstood what you were
> actually looking for, but I think that I understand now.
>
> Since it seems like you want to be able to receive the results out of
> order from both "messengers" and have them continuously listen to
> their respective socket (without affecting the other), a queue is
> likely going to be the best approach. I think you had the right
> general idea with your example, but here's a way to make it
> significantly less cumbersome and easy to expand upon (such as
> expanding the number of websockets to listen to):
>
> ```
> import asyncio
>
> class MessengerQueue:
> def __init__(self):
> self._queue = asyncio.Queue()
>
> async def get(self):
> return await self._queue.get()
>
> async def start_messengers(self):
> # Could be easily modified to create any number of
> "messengers" set to
> # listen on specific websockets, by passing a list and
> creating a task for
> # each one.
> asyncio.create_task(self._messenger("Messenger 1", 1))
> asyncio.create_task(self._messender("Messenger 2", 2))
>
> async def _messenger(self, message: str, sleep_time: int):
> while True:
> await 

Re: [Beginner] Spliting input

2020-06-25 Thread Andrew Jaffe

Hi,

On 25/06/2020 12:50, Bischoop wrote:

I try to split input numbers, for example: 12 so I cant add them, I
tried separated split(' ') but it's not working.
Any ideas how to do this?

*
numb1,numb2=input("enter 1st and 2nd no ").split()
Avg=(int(numb1) + int(numb2)) / 2
print(Avg)



So, this is an opportunity to do (and learn) some debugging!

One problem is that the first line does two things at once -- it reads 
the input and tries to split it into numb1 and numb2. Similarly for the 
"average" line.


You could instead try:

input_string = input("enter 1st and 2nd no ")
print(input_string)
numb1_as_string, numb2_as_string = input_string.split()
print(numb1_as_string, numb2_as_string)
numb1 = int(numb1)
numb2 = int(numb2)
print(numb1, numb2)
avg = (numb1 + numb2) / 2
print(avg)

Now, when if fails on input_string.split() (which I think is what 
happens) you can then be sure that you know what the input is. Let's say 
it's "17,3". Since you know that, you can experiment:


"17, 3".split() -> "17,", "3"  (note extra space)
"17 3".split() -> "17" "3" (aha, getting somewhere)
... and same results for both of these with split(' '), which should 
indicate that it's splitting on the space, and you didn't supply a space.


So now maybe try "17,3".split(',') -> "17", "3" (bingo!)

Bonus question: what happens with "17, 3".split(',')?






*

--
Thanks




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


[issue41098] Deprecating PyUnicodeEncodeError_Create

2020-06-25 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue41119] Wrong error message for list/tuple followed by a colon

2020-06-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 4b85e60601489f9ee9dd2909e28d89a31566887c by Lysandros Nikolaou in 
branch 'master':
bpo-41119: Output correct error message for list/tuple followed by colon 
(GH-21160)
https://github.com/python/cpython/commit/4b85e60601489f9ee9dd2909e28d89a31566887c


--

___
Python tracker 

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



[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-25 Thread Steve Dower


Steve Dower  added the comment:

Okay, so it sounds like there's a class of files where we can't rely on the 
FindFileData having the right values. But we get enough information to be able 
just suppress the caching behaviour for those, right?

Basically, my criteria for fixing this in the runtime is that we should not add 
any new system calls during iteration, and cannot switch to always bypassing 
the cache for DirEntry.stat().

What this probably means is if we can detect a link from the FFD struct (which 
I think we can?) then we can cache the attributes we trust and send .stat() 
through the real call.

What it also means is that the "file still in use by another app" scenario will 
probably have to manually use os.stat(). We can't detect it, and it's the same 
race condition as calling os.stat() shortly before the update flushes anyway.

I won't accept having to make a second set of system calls on every file just 
in case one of them is being modified by another application. That's not the 
normal case, and the point of scandir is to improve performance in the normal 
enumeration cases.

Updating the documentation to mention/emphasise that some DirEntry.stat() 
fields may not update immediately, and so using os.stat() for current data is 
required, may be helpful. Though I think that's already implied by the line 
that says "Call os.stat() to fetch up-to-date information."

So if someone wants to improve the docs, or has a way to recognise links (with 
unreliable data in the directory listing) and not pre-fill the stat object, 
feel free to submit a PR. Otherwise, unfortunately, we're pretty much bound by 
Windows's own optimisations here.

--

___
Python tracker 

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



[issue41120] Possible performance improvement for itertools.product example on Python Docs

2020-06-25 Thread Abbas Taher


New submission from Abbas Taher :

In the documentation the following example is given:

def product(*args, repeat=1):
# product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
# product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111
pools = [tuple(pool) for pool in args] * repeat
result = [[]]
for pool in pools:
result = [x+[y] for x in result for y in pool]
for prod in result:
yield tuple(prod)

The proposed enhancement uses a nested generator so no intermediate results are 
created.

def product2(*args, repeat=1):
def concat(result, pool):
yield from (x+[y] for x in result for y in pool)

pools = [tuple(pool) for pool in args] * repeat
result = [[]]
for pool in pools:
result = concat(result, pool)
for prod in result:
yield (tuple(prod))

--
assignee: docs@python
components: Documentation
files: product example.py
messages: 372392
nosy: ataher, docs@python
priority: normal
severity: normal
status: open
title: Possible performance improvement for itertools.product example on Python 
Docs
type: enhancement
Added file: https://bugs.python.org/file49262/product example.py

___
Python tracker 

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



[issue41103] Removing old buffer support

2020-06-25 Thread Inada Naoki


Change by Inada Naoki :


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



[issue41103] Removing old buffer support

2020-06-25 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed by Inada Naoki in branch 
'master':
bpo-41103: Remove old buffer protocol support (#21117)
https://github.com/python/cpython/commit/6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed


--

___
Python tracker 

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



[issue41119] Wrong error message for list/tuple followed by a colon

2020-06-25 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


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

___
Python tracker 

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



[issue41119] Wrong error message for list/tuple followed by a colon

2020-06-25 Thread Lysandros Nikolaou

New submission from Lysandros Nikolaou :

Brandt found this out while testing his implementation of the `match` 
statement. When a list or tuple are followed by a colon without an annotation, 
the old parser used to say "invalid syntax", while the new parser considers 
this an annotation and outputs something along the lines of "only single target 
(not tuple) can be annotated". For example:

➜  cpython git:(master) ./python.exe
Python 3.10.0a0 (heads/master:06a40d7359, Jun 26 2020, 01:33:34)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> (a, b):
  File "", line 1
(a, b):
^
SyntaxError: only single target (not tuple) can be annotated
>>> [a, b]:
  File "", line 1
[a, b]:
^
SyntaxError: only single target (not list) can be annotated
>>> a,:
  File "", line 1
a,:
^
SyntaxError: only single target (not tuple) can be annotated

The behavior of the old parser seems more logical.

--
assignee: lys.nikolaou
messages: 372390
nosy: brandtbucher, gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Wrong error message for list/tuple followed by a colon
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue41091] Remove recommendation in curses module documentation to initialize LC_ALL and encode strings

2020-06-25 Thread Manuel Jacob


Change by Manuel Jacob :


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

___
Python tracker 

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



[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-25 Thread Eryk Sun


Eryk Sun  added the comment:

> Does it make the most sense for us to make .flush() also do an 
> implicit .fsync() (when it's actually a file object)?

Standard I/O in the Windows C runtime supports a "c" commit mode that causes 
fflush to call _commit() on the underlying fd [1]. Perhaps Python should 
support a similar "c" or "s" mode that makes a flush implicitly call fsync / 
_commit. 

But you may not be in control of flushing the file if it's being written to by 
a third-party library or application. Calling os.[l]stat works around the 
problem, but only with NTFS. It doesn't help with FAT32 / exFAT.

FAT filesystems update the last-write time when the file object is flushed or 
closed. It depends on the FO_FILE_MODIFIED flag in the file object or the 
CCB_FLAG_USER_SET_LAST_WRITE (from SetFileTime) in the file object's context 
control block (CCB). But opening, and even flushing, a file doesn't synchronize 
the context of other opens. Thus one can call os.stat (not even a scandir 
problem) repeatedly on a file and observe st_size changing while st_mtime 
remains constant:

>>> filepath = 'C:/Mount/TestFat32/test/spam.txt'
>>> f = open(filepath, 'w')
>>> s = os.stat(filepath); s.st_size, s.st_mtime
(0, 1593116028.0)

>>> print('spam', file=f, flush=True)
>>> s = os.stat(filepath); s.st_size, s.st_mtime
(6, 1593116028.0)

The last-write time gets updated by closing or flushing the kernel file object 
that was used to write to the file. 

>>> os.fsync(f.fileno())
>>> s = os.stat(filepath); s.st_size, s.st_mtime
(6, 1593116044.0)

Another problem is stale entries for NTFS hard links, which can lead to getting 
a completely incorrect stat result via os.scandir -- wrong timestamps, wrong 
file size, and wrong file attributes.

An NTFS file's MFT record contains its timestamps, size, and attributes in a 
$STANDARD_INFORMATION attribute. This reliable information is what os.[l]stat 
and os.fstat query. But it gets duplicated in per-link $FILE_NAME attributes 
that directories index. The duplicated info for a link gets synchronized to the 
standard info when the link is accessed, but other links to the file do not get 
updated, and their values may be completely wrong. For example (using the scan 
function from my previous post):

>>> filepath1 = 'C:/Mount/TestNtfs/test/spam1.txt'
>>> filepath2 = 'C:/Mount/TestNtfs/test/spam2.txt'
>>> f = open(filepath1, 'w')
>>> os.link(filepath1, filepath2)
>>> s = scan(filepath2).stat(); s.st_size, s.st_mtime
(0, 1593116055.7695396)

>>> print('spam', file=f, flush=True)
>>> s = scan(filepath2).stat(); s.st_size, s.st_mtime
(0, 1593116055.7695396)

>>> os.fsync(f.fileno())
>>> s = scan(filepath2).stat(); s.st_size, s.st_mtime
(0, 1593116055.7695396)

>>> f.close()
>>> s = scan(filepath2).stat(); s.st_size, s.st_mtime
(0, 1593116055.7695396)

As shown, flushing or closing the file object for the "spam1.txt" link is not 
reflected in the entry for the "spam2.txt" link. The directory entry for the 
link is only updated when the link is accessed:

>>> f = open(filepath2)
>>> s = scan(filepath2).stat(); s.st_size, s.st_mtime
(6, 1593116062.2080283)

---

[1] Linking commode.obj should enable commit-mode by default. But it's broken 
because __acrt_stdio_parse_mode is buggy. It initializes _stdio_mode to the 
global _commode value, but then it clobbers it when setting the required "r", 
"w", or "a" open mode.

--

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2020-06-25 Thread Guido van Rossum

Guido van Rossum  added the comment:

But it is undocumented and doesn’t work with -X oldparser.
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue41118] datetime object does not preserve POSIX timestamp

2020-06-25 Thread Grant Petty


New submission from Grant Petty :

For complete context, see 
https://stackoverflow.com/questions/62582386/how-do-i-get-a-naive-datetime-object-that-correctly-uses-utc-inputs-and-preserve

Short version: It does not seem correct that a datetime object produced *from* 
a POSIX timestamp using utcfromtimestamp should then return a different 
timestamp.  As a user, I would like to be able to count on the POSIX timestamp 
as being the one conserved property of a datetime object, regardless of whether 
it is naive or time zone aware.

> dt0 = dt.datetime(year=2020, month=1, day=1,hour=0,minute=0, tzinfo=pytz.utc)
> print(dt0)

2020-01-01 00:00:00+00:00

> ts0 = dt0.timestamp()
> print(ts0)

1577836800.0

> dt1 = dt.datetime.utcfromtimestamp(ts0)
> print(dt1)

2020-01-01 00:00:00

> ts1 = dt1.timestamp()
> print(ts1)

1577858400.0

--
messages: 372387
nosy: gpetty
priority: normal
severity: normal
status: open
title: datetime object does not preserve POSIX timestamp
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue41111] Convert a few stdlib extensions to the limited C API

2020-06-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

While this might make for an interesting validation experiment, I don't think 
the results should be checked in.

Code churn is to be avoided when there is no visible user benefit.  It risks 
destabilizing code, introducing errors, and making the code less recognizable 
to the other developers who created and maintained it.

--
nosy: +rhettinger

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2020-06-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This is already implemented in master with the new PEG parser so closing this.

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2020-06-25 Thread thautwarm


thautwarm  added the comment:

Maybe you should close this.

--

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2020-06-25 Thread thautwarm


thautwarm  added the comment:

I can confirm Guido's words, now parentheses for continuation across lines are 
already supported.

Even without parentheses, multiline with items can be supported. I just 
implemented it here: 
https://github.com/thautwarm/cpython/blob/bpo-12782/Grammar/python.gram#L180-L187

  from contextlib import contextmanager

  @contextmanager
  def f(x):
try:
yield x
finally:
pass

# Ok
  with f('c') as a,
   f('a') as b:
   pass


# Ok
  with f('c') as a,
   f('a') as b,
   f('a') as c:
   pass


  # ERROR
  with f('c') as a,
   f('a') as b,
   f('a') as c:
 x = 1 + 1

  # message:
File "/home/thaut/github/cpython/../a.py", line 49
  x = 1 + 1
 ^
IndentationError: unindent does not match any outer indentation 
level

  # ERROR
  with f('c') as a,
   f('a') as b,
   f('a') as c:
  x = 1 + 1

  File "/home/thaut/github/cpython/../a.py", line 49
x = 1 + 1
  
  IndentationError: unexpected indent



The grammar is:


with_stmt[stmt_ty]:
| ...
| 'with' a=(',' [NEWLINE ~ INDENT?]).with_item+ ':' tc=[TYPE_COMMENT] 
NEWLINE b=statements DEDENT {
_Py_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }
| ...

The restriction here is, since the second 'with_item', until the end of 
'statements', the expression and statements have to keep the same indentation.

with item1,
   item2,
   ...:
   block

The indentation of 'item2', ..., 'block' should be the same.

This implementation leverages the new PEG and how the lexer deals with 
indent/dedent.

--

___
Python tracker 

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



Re: Pycharm Won't Do Long Underscore

2020-06-25 Thread Michael Torrie
On 6/24/20 7:38 PM, Grant Edwards wrote:
> On 2020-06-24, Peter J. Holzer  wrote:
> 
>> There is U+FF3F Fullwidth Low Line.
>>
>>> If there were, Python would not know what to do with it
>>
>> You can use it in variable names, but not at the beginning, and it isn't
>> equivalent to two underscores, of course:
> 
> Ouch.  Anybody caught using that should be fed to a large snake.

Even allowing unicode letters in variable names period is questionable,
but that loud debate was over years ago.  Fortunately I have never seen
any python code in the wild with non-latin characters for variable
names.  Would make editing code very painful for developers from
different locales and keyboards. Even if it might seem novel at first to
have π be a variable name.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41069] Use non-ascii file names in tests by default

2020-06-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue41069] Use non-ascii file names in tests by default

2020-06-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset f925407a19eeb9bf5f7640143979638adce2c677 by Serhiy Storchaka in 
branch '3.9':
[3.9] bpo-41069: Make TESTFN and the CWD for tests containing non-ascii 
characters. (GH-21035). (GH-21156)
https://github.com/python/cpython/commit/f925407a19eeb9bf5f7640143979638adce2c677


--

___
Python tracker 

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



[issue40799] Create Lib/_pydatetime.py file to optimize "import datetime" when _datetime is available

2020-06-25 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-06-25 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 847f94f47b104aec678d1d2a2d8fe23d817f375e by Hai Shi in branch 
'master':
bpo-40275: Use new test.support helper submodules in tests (GH-21151)
https://github.com/python/cpython/commit/847f94f47b104aec678d1d2a2d8fe23d817f375e


--

___
Python tracker 

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



[issue41117] [easy C] GC: Use local variable 'op' when invoking 'traverse' in 'subtract_refs'

2020-06-25 Thread William Pickard


New submission from William Pickard :

When the GC module goes to collect objects (most notably, during Python 
shutdown), it makes a call to subtract_refs on the GC container.

During this invocation, it creates a local variable "op" who's value is the 
result of 'FROM_GC(gc)', but when it goes to use the obtained 'traverse' 
method, it calls FROM_GC(gc) instead of using 'op'.

This, unfortunately, makes it rather difficult to debug "Access Violations" for 
extension modules for when 'traverse' is 'NULL' as inspecting the variable 'op' 
in the chosen debugger (for my case: Visual Studio on Windows) is impossible.

This can potentially introduce a micro optimization in the overall runtime of 
the GC module as it no longer has to invoke the addition instruction (if it 
does) to construct the first parameter of the 'traverse' call.

--
components: C API, Interpreter Core
files: cpython.patch
keywords: patch
messages: 372380
nosy: WildCard65
priority: normal
severity: normal
status: open
title: [easy C] GC: Use local variable 'op' when invoking 'traverse' in 
'subtract_refs'
type: enhancement
versions: Python 3.10
Added file: https://bugs.python.org/file49261/cpython.patch

___
Python tracker 

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



[issue41115] Codecs should raise precise UnicodeDecodeError or UnicodeEncodeError

2020-06-25 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue40309] “unmatched paren” for space before parenthesis in Py_BuildValue

2020-06-25 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 1.0 -> 2.0
pull_requests: +20318
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21158

___
Python tracker 

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



[issue34137] Add Path.lexist() to pathlib

2020-06-25 Thread Nils Philippsen


Nils Philippsen  added the comment:

I've come across this issue lately and proposed a PR which implements this and, 
analogous to os.stat(), adds a follow_symlinks parameter to Path.exists().

--

___
Python tracker 

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



[issue41116] build on macOS 11 (beta) does not find system-supplied third-party libraries

2020-06-25 Thread Ned Deily


New submission from Ned Deily :

When building on macOS 11 (beta), a number of modules that should normally 
build on macOS fail because the system-supplied third-party libraries are not 
found.

The necessary bits to build these optional modules were not found:
_bz2  _curses   _curses_panel
_gdbm _hashlib  _lzma
_ssl  ossaudiodev   readline
spwd  zlib

The list should look like this (with no additional third-party libs supplied 
from another source like Homebrew or MacPorts):

The necessary bits to build these optional modules were not found:
_gdbm _hashlib  _ssl
ossaudiodev   spwd

The problem is due to a change in the 11 beta versus 10.15 or earlier systems: 
"New in macOS Big Sur 11 beta, the system ships with a built-in dynamic linker 
cache of all system-provided libraries. As part of this change, copies of 
dynamic libraries are no longer present on the filesystem. Code that attempts 
to check for dynamic library presence by looking for a file at a path or 
enumerating a directory will fail. Instead, check for library presence by 
attempting to dlopen() the path, which will correctly check for the library in 
the cache."

This breaks tests in setup.py using find_library_file() to determine if a 
library is present and in what directory it exists.  setup.py depends on 
Lib/distutils/unixccompiler.py to do the dirty work. A similar problem arose on 
earlier macOS releases when header files could no longer be installed in the 
systems /usr/include; setup.py had to be taught to look in the SDK being used 
implicitly or explicitly by the compiler preprocessor.  We could probably do 
something like that here while trying to avoid changes that might break 
downstream supplements/replacements to distutils, for example, setuptools.

There is a workaround: explicitly specify the SDK location to ./configure (you 
also need to specify the universal archs setting):

./configure \
--enable-universalsdk=$(xcodebuild -version -sdk macosx Path) \
--with-universal-archs=intel-64 \
...

--
components: macOS
messages: 372379
nosy: ned.deily, ronaldoussoren
priority: high
severity: normal
status: open
title: build on macOS 11 (beta) does not find system-supplied third-party 
libraries
versions: Python 3.10, Python 3.7, 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



[issue34137] Add Path.lexist() to pathlib

2020-06-25 Thread Nils Philippsen


Change by Nils Philippsen :


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

___
Python tracker 

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



[issue41069] Use non-ascii file names in tests by default

2020-06-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +20315
pull_request: https://github.com/python/cpython/pull/21156

___
Python tracker 

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



[issue41100] Build failure on macOS 11 (beta)

2020-06-25 Thread Ned Deily


Ned Deily  added the comment:


New changeset cfbc759f918d646a59acb99251fc10b3900248a6 by Miss Islington (bot) 
in branch '3.7':
BPO-41100: Support macOS 11 when building (GH-21113) (GH-21155)
https://github.com/python/cpython/commit/cfbc759f918d646a59acb99251fc10b3900248a6


--

___
Python tracker 

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



[issue41100] Build failure on macOS 11 (beta)

2020-06-25 Thread miss-islington


miss-islington  added the comment:


New changeset c4a53e48a98b3d8fdcfc11d1b5af3ea0dd987a88 by Miss Islington (bot) 
in branch '3.8':
BPO-41100: Support macOS 11 when building (GH-21113)
https://github.com/python/cpython/commit/c4a53e48a98b3d8fdcfc11d1b5af3ea0dd987a88


--

___
Python tracker 

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



[issue41100] Build failure on macOS 11 (beta)

2020-06-25 Thread miss-islington


miss-islington  added the comment:


New changeset ad7a66731f2681c626f32f097e1e91cdc02330ab by Miss Islington (bot) 
in branch '3.9':
BPO-41100: Support macOS 11 when building (GH-21113)
https://github.com/python/cpython/commit/ad7a66731f2681c626f32f097e1e91cdc02330ab


--

___
Python tracker 

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



[issue41115] Codecs should raise precise UnicodeDecodeError or UnicodeEncodeError

2020-06-25 Thread Walter Dörwald

Walter Dörwald  added the comment:

UnicodeEncodeError and UnicodeDecodeError are used to report un(en|de)codedable 
ranges in the source object, so it wouldn't make sense to use them for errors 
that have nothing to do with problems in the source object. Their constructor 
requires 5 arguments (encoding, object, start, end, reason), not just a simple 
message: e.g. UnicodeEncodeError("utf-8", "foo", 17, 23, "bad string").

But for reporting e.g. missing BOMs at the start it would be useful to use (0,  
0) as the offending range.

--
nosy: +doerwalter

___
Python tracker 

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



[issue41100] Build failure on macOS 11 (beta)

2020-06-25 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +20312
pull_request: https://github.com/python/cpython/pull/21153

___
Python tracker 

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



[issue41100] Build failure on macOS 11 (beta)

2020-06-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20313
pull_request: https://github.com/python/cpython/pull/21154

___
Python tracker 

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



[issue41069] Use non-ascii file names in tests by default

2020-06-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 700cfa8c90a90016638bac13c4efd03786b2b2a0 by Serhiy Storchaka in 
branch 'master':
bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. 
(GH-21035)
https://github.com/python/cpython/commit/700cfa8c90a90016638bac13c4efd03786b2b2a0


--

___
Python tracker 

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



[issue41100] Build failure on macOS 11 (beta)

2020-06-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20314
pull_request: https://github.com/python/cpython/pull/21155

___
Python tracker 

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



[issue41100] Build failure on macOS 11 (beta)

2020-06-25 Thread Ned Deily


Ned Deily  added the comment:


New changeset 8ea6353f60625c96ce96588c70ff24a77f8c71f9 by Ronald Oussoren in 
branch 'master':
BPO-41100: Support macOS 11 when building (GH-21113)
https://github.com/python/cpython/commit/8ea6353f60625c96ce96588c70ff24a77f8c71f9


--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-06-25 Thread Ned Deily


Ned Deily  added the comment:


New changeset 8d02f91dc6139a13b6efa9bd5a5b4bdd7ddcc29d by Ned Deily in branch 
'master':
bpo-40939: run autoreconf to fix configure{,.ac} disparity (GH-21152)
https://github.com/python/cpython/commit/8d02f91dc6139a13b6efa9bd5a5b4bdd7ddcc29d


--

___
Python tracker 

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



[issue40939] Remove the old parser

2020-06-25 Thread Ned Deily


Change by Ned Deily :


--
nosy: +ned.deily
nosy_count: 7.0 -> 8.0
pull_requests: +20311
pull_request: https://github.com/python/cpython/pull/21152

___
Python tracker 

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



Re: Pycharm offers only implementation of an abstract getter but not an abstract setter

2020-06-25 Thread zljubisic
You can freely leave Pycharm out of equation.
In that case, there is a question how to force subclass to implement setter 
method?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41115] Codecs should raise precise UnicodeDecodeError or UnicodeEncodeError

2020-06-25 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Hi,

IMO this can be mark as an easy issue.

@thatiparthy please, go ahead

--
nosy: +eamanu

___
Python tracker 

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



Re: Pycharm offers only implementation of an abstract getter but not an abstract setter

2020-06-25 Thread Rhodri James

On 24/06/2020 22:46, zljubi...@gmail.com wrote:

Why Pycharm didn't offer a setter as well as getter?


This is a general Python mailing list.  If you have specific 
questions/complaints about PyCharm, they are probably better addressed 
directly to the makers of PyCharm.


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


[issue41115] Codecs should raise precise UnicodeDecodeError or UnicodeEncodeError

2020-06-25 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి

Srinivas  Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) 
 added the comment:

This looks like an easy task. Shall I create a PR?

--
nosy: +thatiparthy

___
Python tracker 

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



Re: [Beginner] Spliting input

2020-06-25 Thread Peter Otten
Bischoop wrote:

> I try to split input numbers, for example: 12 so I cant add them, I
> tried separated split(' ') but it's not working.
> Any ideas how to do this?
> 
> *
> numb1,numb2=input("enter 1st and 2nd no ").split()
> Avg=(int(numb1) + int(numb2)) / 2
> print(Avg)
> *
> 
> --
> Thanks

To split the string "12" into its characters (i. e. the digits "1" and "2") 
you don't need the split() method which only works with separators.
Instead you can unpack the digits directly:

>>> a, b = input("enter two digits> ")
enter two digits> 12
>>> a
'1'
>>> b
'2'
>>> (int(a) + int(b)) / 2
1.5


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


[issue41115] Codecs should raise precise UnicodeDecodeError or UnicodeEncodeError

2020-06-25 Thread Antoine Pitrou


New submission from Antoine Pitrou :

A number of codecs raise bare UnicodeError, rather than 
Unicode{Decode,Encode}Error. Example:

  File 
"/home/antoine/miniconda3/envs/pyarrow/lib/python3.7/encodings/utf_16.py", line 
67, in _buffer_decode
raise UnicodeError("UTF-16 stream does not start with BOM")

A more complete list can be found here:
https://gist.github.com/pitrou/60594b28d8e47edcdb97d9b15d5f9866

--
components: Library (Lib)
keywords: easy
messages: 372367
nosy: benjamin.peterson, ezio.melotti, lemburg, pitrou, serhiy.storchaka, 
vstinner
priority: normal
severity: normal
stage: needs patch
status: open
title: Codecs should raise precise UnicodeDecodeError or UnicodeEncodeError
type: behavior
versions: Python 3.7, 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



[issue41114] "TypeError: unhashable type" could often be more clear

2020-06-25 Thread Samuel Freilich


New submission from Samuel Freilich :

Currently, if you (for example) put a dict as a value in a set or key in a 
dict, you get:

TypeError: unhashable type: 'dict'

I'm pretty sure this wording goes back a long time, but I've noticed that 
Python beginners tend to find this really confusing. It fits into a pattern of 
error messages where you have to explain why the error message is worded the 
way it is after you explain why the error message occurs at all. There are many 
instances of:
https://stackoverflow.com/questions/13264511/typeerror-unhashable-type-dict

It would be clearer if the message was something like:

TypeError: 'dict' can not be used as a set value because it is an unhashable 
type.

(Or "dict key" instead of "set value".)

The exception is raised in PyObject_Hash, so that doesn't have some of the 
context about how/why hash was called. That's called in a lot of places.

Possibly, PyObject_Hash and PyObject_HashNotImplemented could take the format 
string passed to PyErr_Format as an optional second argument, defaulting to the 
current behavior? Then certain callers (in particular, the set and dict 
constructor, set and dict methods that add set values or add/modify dict keys) 
could provide clearer error messages.

--
messages: 372366
nosy: sfreilich
priority: normal
severity: normal
status: open
title: "TypeError: unhashable type" could often be more clear
type: behavior

___
Python tracker 

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



[issue41113] test_warnings fails on non-Western locales

2020-06-25 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



[issue41112] test_peg_generator fails on non-UTF-8 locale

2020-06-25 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



[issue40275] test.support has way too many imports

2020-06-25 Thread hai shi


Change by hai shi :


--
pull_requests: +20310
pull_request: https://github.com/python/cpython/pull/21151

___
Python tracker 

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



[issue35773] test_bdb fails on non-UTF-8 locale

2020-06-25 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



Re: [Beginner] Spliting input

2020-06-25 Thread Frank Millman

On 2020-06-25 2:13 PM, Bischoop wrote:

On 2020-06-25, Andrew Bell  wrote:

Without knowing the problem you're having, it's hard to answer.
This seems generally correct.



Error track:
Traceback (most recent call last):
   File "splitting.py", line 1, in 
   numb1,numb2=input("enter 1st and 2nd no ").split()
   ValueError: not enough values to unpack (expected 2, got 1)



Without arguments, split() splits on whitespace.

If you entered 2 numbers separated by a comma, but no spaces, there is 
no split.


Maybe you meant split(',') which will split on a comma.

Frank Millman


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


[issue41112] test_peg_generator fails on non-UTF-8 locale

2020-06-25 Thread miss-islington


miss-islington  added the comment:


New changeset c4dfcb28f7d466de152db75e7bae9de694bf0f0e by Miss Islington (bot) 
in branch '3.9':
bpo-41112: Fix test_peg_generator on non-UTF-8 locales. (GH-21138)
https://github.com/python/cpython/commit/c4dfcb28f7d466de152db75e7bae9de694bf0f0e


--

___
Python tracker 

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



[issue41113] test_warnings fails on non-Western locales

2020-06-25 Thread miss-islington


miss-islington  added the comment:


New changeset 086b4539806e296af9b68591670d12a22e170d43 by Miss Islington (bot) 
in branch '3.9':
bpo-41113: Fix test_warnings on non-Western locales. (GH-21143)
https://github.com/python/cpython/commit/086b4539806e296af9b68591670d12a22e170d43


--

___
Python tracker 

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



[issue41009] @support.requires_*_version broken for classes

2020-06-25 Thread Ned Deily


Change by Ned Deily :


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



[issue40275] test.support has way too many imports

2020-06-25 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 06a40d735939fd7d5cb77a68a6e18299b6484fa5 by Hai Shi in branch 
'master':
bpo-40275: Use new test.support helper submodules in tests (GH-20824)
https://github.com/python/cpython/commit/06a40d735939fd7d5cb77a68a6e18299b6484fa5


--

___
Python tracker 

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



[issue41009] @support.requires_*_version broken for classes

2020-06-25 Thread miss-islington


miss-islington  added the comment:


New changeset 8075fe199b0569428cebaf213663bdd1ca40d792 by Christian Heimes in 
branch '3.8':
[3.8] bpo-41009: fix requires_OS_version() class decorator (GH-20942) (GH-20948)
https://github.com/python/cpython/commit/8075fe199b0569428cebaf213663bdd1ca40d792


--

___
Python tracker 

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



[issue41009] @support.requires_*_version broken for classes

2020-06-25 Thread miss-islington


miss-islington  added the comment:


New changeset cd6f9110974f733d10d9eef36a9a769a29cd3295 by Christian Heimes in 
branch '3.9':
[3.9] bpo-41009: fix requires_OS_version() class decorator (GH-20942) (GH-20947)
https://github.com/python/cpython/commit/cd6f9110974f733d10d9eef36a9a769a29cd3295


--

___
Python tracker 

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



Re: [Beginner] Spliting input

2020-06-25 Thread Bischoop
On 2020-06-25, Andrew Bell  wrote:
> Without knowing the problem you're having, it's hard to answer.
> This seems generally correct.
>
>
Error track:
Traceback (most recent call last):
  File "splitting.py", line 1, in 
  numb1,numb2=input("enter 1st and 2nd no ").split()
  ValueError: not enough values to unpack (expected 2, got 1)

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


[issue41009] @support.requires_*_version broken for classes

2020-06-25 Thread Ned Deily


Ned Deily  added the comment:


New changeset d3798ed9f1762dcf632369505d517f476eccde13 by Christian Heimes in 
branch '3.7':
[3.7] bpo-41009: fix requires_OS_version() class decorator (GH-20942) (GH-20949)
https://github.com/python/cpython/commit/d3798ed9f1762dcf632369505d517f476eccde13


--
nosy: +ned.deily

___
Python tracker 

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



[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-25 Thread Cezary Wagner


Cezary Wagner  added the comment:

I read some comments os.flush() or os.fsync() can be unrelated to problem. 
External application can be written in C# or whatever you want.

Under Windows (not Linux) - modification dates will be stalled in such sequence.
os.scandir()
dir_entry.stat() # let it be dir_entry.path == 'test.txt'
dir_entry.stat().st_mtime # will be for example 1
os.scandir()
dir_entry.stat() # let it be dir_entry.path == 'test.txt'
dir_entry.stat().st_mtime # will be STALLED for example 1


Under Windows (not Linux) - modification dates will be refreshed in such 
sequence.
os.scandir()
dir_entry.stat() # let it be dir_entry.path == 'test.txt'
dir_entry.stat().st_mtime # will be for example 1
os.stat('test.txt') # this code do something and it is not stalled in next call
os.scandir()
dir_entry.stat() # let it be dir_entry.path == 'test.txt'
dir_entry.stat().st_mtime # will be CHANGED for example 2

--

___
Python tracker 

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



Re: [Beginner] Spliting input

2020-06-25 Thread Andrew Bell
Without knowing the problem you're having, it's hard to answer.
This seems generally correct.

On Thu, Jun 25, 2020 at 7:57 AM Bischoop  wrote:

> I try to split input numbers, for example: 12 so I cant add them, I
> tried separated split(' ') but it's not working.
> Any ideas how to do this?
>
> *
> numb1,numb2=input("enter 1st and 2nd no ").split()
> Avg=(int(numb1) + int(numb2)) / 2
> print(Avg)
>

-- 
Andrew Bell
andrew.bell...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30951] Documentation error in inspect module

2020-06-25 Thread Xavier Morel


Xavier Morel  added the comment:

Maybe something along the lines of "names other than arguments and function 
locals", or "names of the symbols used in the code object, other than arguments 
and function locals"? This is still slightly confusing because in the case of 
an import the name is present in both mappings, but less so than the outright 
lie of the current version.

Serhiy, is there a way to access the class's code object from Python? Also does 
that mean varnames is not used by class code objects despite it stating 
unambiguously that it stores locals?

--
nosy: +xmorel

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2020-06-25 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 91698d8caa4b5bb6e8dbb64b156e8afe9e32cac1 by Victor Stinner in 
branch 'master':
bpo-40521: Optimize PyBytes_FromStringAndSize(str, 0) (GH-21142)
https://github.com/python/cpython/commit/91698d8caa4b5bb6e8dbb64b156e8afe9e32cac1


--

___
Python tracker 

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



[issue41112] test_peg_generator fails on non-UTF-8 locale

2020-06-25 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +20309
pull_request: https://github.com/python/cpython/pull/21150

___
Python tracker 

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



[issue41113] test_warnings fails on non-Western locales

2020-06-25 Thread miss-islington


miss-islington  added the comment:


New changeset f547d06ea7db23bb0a2cf81ff85478746efa958e by Miss Islington (bot) 
in branch '3.8':
bpo-41113: Fix test_warnings on non-Western locales. (GH-21143)
https://github.com/python/cpython/commit/f547d06ea7db23bb0a2cf81ff85478746efa958e


--

___
Python tracker 

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



[issue41113] test_warnings fails on non-Western locales

2020-06-25 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20308
pull_request: https://github.com/python/cpython/pull/21149

___
Python tracker 

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



[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-25 Thread Cezary Wagner


Cezary Wagner  added the comment:

Use case - detection of changes in open files is very important - log scanning 
- synchronization ...

I think that first of all it is need good unit test to detect this problem 
(rare edge case - probably it is missed because hard to imagine that it can not 
work when file is open - I will miss this I think).

It should work like this.

First program is writing file under Windows and second program (unit test) is 
running os.scandir() if repeated os.scandir() detect changes it is O.K. (same 
like in Linux).

To make it simpler it can be unit test in one program.

1. Open test file in test directory.
2. os.scandir() in test directory.
3. Some writes to test file (f.write() with and without flush, ... - to be 
defined what is sufficient to test).
4. os.scandir() in test directory - if change detected it O.K.
5. f.close()

I do not know Windows API now but I think we can detect id directory is changed 
between scans or we can detect if file is open (it is rare situation - rare 
edge case) in 90% all files will be closed.

So if all files is closed current os.scandir() maybe is good (not I do not 
understand implementation to evaluate it correclty) and when one of file or 
more there is need another implementation which will detect modification.

If you think I missed something please comment. You are welcome.

--

___
Python tracker 

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



[Beginner] Spliting input

2020-06-25 Thread Bischoop
I try to split input numbers, for example: 12 so I cant add them, I
tried separated split(' ') but it's not working.
Any ideas how to do this?

*
numb1,numb2=input("enter 1st and 2nd no ").split()
Avg=(int(numb1) + int(numb2)) / 2
print(Avg)
*

--
Thanks

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


[issue41106] os.scandir() Windows bug dir_entry.stat() not works on file during writing.

2020-06-25 Thread Cezary Wagner


Cezary Wagner  added the comment:

I do some test on linux all works - changes are detected and os.scandir() works 
but in Windows not - probably there is not unit test which check if 
os.scandir() is working on open files for writing.

f.flush() no matter since file can be changed in external Python/Java/C#/C++, 
... application - anyone can write logs in Windows. I will explain it in next 
comment. I just write this code to show only problem.

Result from linux STAT = False so only repeat os.scandir() calls. Modification 
are detected correctly in Linux but not in Windows.

[wagnecaz@nsdptrms01 ~]$ python3 s03_dir_entry.py
dir_entry.stat() /home/wagnecaz/test.txt 1593085189.1000397 since last change 
0.00111671508789
2020-06-25 13:39:49.101368 1593085189.101368
dir_entry.stat() /home/wagnecaz/test.txt 1593085189.1000397 since last change 
1.0028572082519531
2020-06-25 13:39:50.103111 1593085190.103111
dir_entry.stat() /home/wagnecaz/test.txt 1593085190.1020408 since last change 
1.0026073455810547
2020-06-25 13:39:51.104881 1593085191.104881
dir_entry.stat() /home/wagnecaz/test.txt 1593085191.104042 since last change 
1.0023958683013916
2020-06-25 13:39:52.106793 1593085192.106793
dir_entry.stat() /home/wagnecaz/test.txt 1593085192.106043 since last change 
1.0023260116577148
2020-06-25 13:39:53.108582 1593085193.108582
dir_entry.stat() /home/wagnecaz/test.txt 1593085193.1080444 since last change 
1.0021436214447021
2020-06-25 13:39:54.110500 1593085194.1105
dir_entry.stat() /home/wagnecaz/test.txt 1593085194.1100454 since last change 
1.0013866424560547
2020-06-25 13:39:55.111684 1593085195.111684
dir_entry.stat() /home/wagnecaz/test.txt 1593085195.1110466 since last change 
1.0022354125976562
2020-06-25 13:39:56.113542 1593085196.113542
dir_entry.stat() /home/wagnecaz/test.txt 1593085196.1130476 since last change 
1.0021603107452393
2020-06-25 13:39:57.115450 1593085197.11545
dir_entry.stat() /home/wagnecaz/test.txt 1593085197.1140487 since last change 
1.003014326095581

Change is done every 1s and detected in Linux in Windows it is stalled.
2020-06-25 13:39:58.117287 1593085198.117287
dir_entry.stat() /home/wagnecaz/test.txt 1593085198.11605 since last change 
1.002938985824585
2020-06-25 13:39:59.119224 1593085199.119224
dir_entry.stat() /home/wagnecaz/test.txt 1593085199.118051 since last change 
1.0027978420257568
2020-06-25 13:40:00.121166 1593085200.121166

--

___
Python tracker 

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



[issue40204] Docs build error with Sphinx 3.0 due to invalid C declaration

2020-06-25 Thread Ned Deily


Ned Deily  added the comment:


New changeset 7318f0ab234e1c60a19eeea4e5968fb5d4fd70af by Ned Deily in branch 
'3.8':
bpo-40204: Pin Sphinx version to 2.3.1 in ``Doc/Makefile``. (GH-21141) 
(GH-21147)
https://github.com/python/cpython/commit/7318f0ab234e1c60a19eeea4e5968fb5d4fd70af


--

___
Python tracker 

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



[issue41113] test_warnings fails on non-Western locales

2020-06-25 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 1.0 -> 2.0
pull_requests: +20307
pull_request: https://github.com/python/cpython/pull/21148

___
Python tracker 

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



  1   2   >