[issue39609] Set the thread_name_prefix for asyncio's default executor ThreadPoolExecutor

2020-02-17 Thread Markus Mohrhard


Markus Mohrhard  added the comment:

We have by now changed to a custom executor. Asyncio is used in some of our 
dependencies and therefore it took some work to figure out what is creating the 
thousands of threads that we were seeing.

This patch was part of the debuggin and we thought it would be useful for 
anyone else to immediately see what is creating the threads.

--

___
Python tracker 

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



Re: insert data in python script

2020-02-17 Thread alberto
Il giorno lunedì 17 febbraio 2020 17:48:07 UTC+1, alberto ha scritto:
> Hi, 
> I would use this script to evaluate fugacity coefficient with PENG-ROBINSON 
> equation, but I don't understand the correct mode to insert data
> 
> import numpy as np
> import matplotlib.pyplot as plt
> from scipy.optimize import newton
> 
> R = 8.314e-5  # universal gas constant, m3-bar/K-mol
> class Molecule:
> """
> Store molecule info here
> """
> def __init__(self, name, Tc, Pc, omega):
> """
> Pass parameters desribing molecules
> """
> #! name
> self.name = name
> #! Critical temperature (K)
> self.Tc = Tc
> #! Critical pressure (bar)
> self.Pc = Pc
> #! Accentric factor
> self.omega = omega
> 
> def print_params(self):
> """
> Print molecule parameters.
> """
> print("""Molecule: %s.
> \tCritical Temperature = %.1f K
> \tCritical Pressure = %.1f bar.
> \tAccentric factor = %f""" % (self.name, self.Tc, self.Pc, 
> self.omega))
> 
> def preos(molecule, T, P, plotcubic=True, printresults=True):
> """
> Peng-Robinson equation of state (PREOS)
> 
> http://en.wikipedia.org/wiki/Equation_of_state#Peng.E2.80.93Robinson_equation_of_state
> :param molecule: Molecule molecule of interest
> :param T: float temperature in Kelvin
> :param P: float pressure in bar
> :param plotcubic: bool plot cubic polynomial in compressibility factor
> :param printresults: bool print off properties
> Returns a Dict() of molecule properties at this T and P.
> """
> # build params in PREOS
> Tr = T / molecule.Tc  # reduced temperature
> a = 0.457235 * R**2 * molecule.Tc**2 / molecule.Pc
> b = 0.0777961 * R * molecule.Tc / molecule.Pc
> kappa = 0.37464 + 1.54226 * molecule.omega - 0.26992 * molecule.omega**2
> alpha = (1 + kappa * (1 - np.sqrt(Tr)))**2
> 
> A = a * alpha * P / R**2 / T**2
> B = b * P / R / T
> 
> # build cubic polynomial
> def g(z):
> """
> Cubic polynomial in z from EOS. This should be zero.
> :param z: float compressibility factor
> """
> return z**3 - (1 - B) * z**2 + (A - 2*B - 3*B**2) * z - (
> A * B - B**2 - B**3)
> 
> # Solve cubic polynomial for the compressibility factor
> z = newton(g, 1.0)  # compressibility factor
> rho = P / (R * T * z)  # density
> 
> # fugacity coefficient comes from an integration
> fugacity_coeff = np.exp(z - 1 - np.log(z - B) - A / np.sqrt(8) / B * 
> np.log(
> (z + (1 + np.sqrt(2)) * B) / (z + (1 - np.sqrt(2)) * B)))
> 
> if printresults:
> print("""PREOS calculation at
> \t T = %.2f K
> \t P = %.2f bar""" % (T, P))
> print("\tCompressibility factor : ", z)
> print("\tFugacity coefficient: ", fugacity_coeff)
> print("\tFugacity at pressure %.3f bar = %.3f bar" % (
> P, fugacity_coeff * P))
> print("\tDensity: %f mol/m3" % rho)
> print("\tMolar volume: %f L/mol" % (1.0 / rho * 1000))
> print("\tDensity: %f v STP/v" % (rho * 22.4 / 1000))
> print("\tDensity of ideal gas at same conditions: %f v STP/v" % (
> rho * 22.4/ 1000 * z))
> 
> if plotcubic:
> # Plot the cubic equation to visualize the roots
> zz = np.linspace(0, 1.5)  # array for plotting
> 
> plt.figure()
> plt.plot(zz, g(zz), color='k')
> plt.xlabel('Compressibility, $z$')
> plt.ylabel('Cubic $g(z)$')
> plt.axvline(x=z)
> plt.axhline(y=0)
> plt.title('Root found @ z = %.2f' % z)
> plt.show()
> return {"density(mol/m3)": rho, "fugacity_coefficient": fugacity_coeff,
> "compressibility_factor": z, "fugacity(bar)": fugacity_coeff * P,
> "molar_volume(L/mol)": 1.0 / rho * 1000.0}
> 
> def preos_reverse(molecule, T, f, plotcubic=False, printresults=True):
> """
> Reverse Peng-Robinson equation of state (PREOS) to obtain pressure for a 
> particular fugacity
> :param molecule: Molecule molecule of interest
> :param T: float temperature in Kelvin
> :param f: float fugacity in bar
> :param plotcubic: bool plot cubic polynomial in compressibility factor
> :param printresults: bool print off properties
> Returns a Dict() of molecule properties at this T and f.
> """
> # build function to minimize: difference between desired fugacity and 
> that obtained from preos
> def g(P):
> """
> :param P: pressure
> """
> return (f - preos(molecule, T, P, plotcubic=False, 
> printresults=False)["fugacity(bar)"])
> 
> # Solve preos for the pressure
> P = newton(g, f)  # pressure
> 
> # Obtain remaining parameters
> pars = preos(molecule, T, P, plotcubic=plotcubic, 
> printresults=printresults)
> rho = 

[issue39668] segmentation fault on calling __reversed__()

2020-02-17 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

This could be fixed with 24dc2f8c56697f9ee51a4887cf0814b6600c1815 issue38525

➜  cpython git:(24dc2f8c56) ./python.exe -c 'list((lambda: 
None).__annotations__.__reversed__())'
➜  cpython git:(24dc2f8c56) git checkout HEAD~1
Previous HEAD position was 24dc2f8c56 bpo-38525: Fix a segmentation fault when 
using reverse iterators of empty dict (GH-16846)
HEAD is now at 88eeda6311 Remove doc reference to unmaitained Nose package 
(GH-16849)
➜  cpython git:(88eeda6311) make -s -j4 2> /dev/null
➜  cpython git:(88eeda6311) ./python.exe -c 'list((lambda: 
None).__annotations__.__reversed__())'
[1]36178 segmentation fault  ./python.exe -c 'list((lambda: 
None).__annotations__.__reversed__())'

--
nosy: +xtreak

___
Python tracker 

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



[issue39668] segmentation fault on calling __reversed__()

2020-02-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This works fine for me on macOS using the python.org 64-bit build.

What are you using?

--
nosy: +rhettinger

___
Python tracker 

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



[issue37373] Configuration of windows event loop for libraries

2020-02-17 Thread Michael Hall


Change by Michael Hall :


--
nosy: +mikeshardmind

___
Python tracker 

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



[issue39232] asyncio crashes when tearing down the proactor event loop

2020-02-17 Thread Michael Hall


Michael Hall  added the comment:

Linking out to a real-world example where this still manages to happen after 
running the event loop for an entire 2 seconds waiting for transports to close 
themselves after finishing everything else:

https://github.com/Cog-Creators/Red-DiscordBot/issues/3560

As well as what we're currently looking at for a temporary solution for this at 
this point:

https://github.com/Cog-Creators/Red-DiscordBot/pull/3566


I looked into what would need to change to handle this in CPython, but am not 
confident in my ability to make such a PR after doing so, at least not without 
more discussion about it.

The best solution I considered involves making the only public way to make 
transports be tied to an event loop which hasn't been closed yet, and ensuring 
the event loop keeps a reference to each of these so that it can 
deterministically close them at loop finalization. Searching GitHub alone found 
that this would break way too many things.

If this can't be fully fixed, a solution which at least ensures this can't 
cause an uncatchable exception would be appreciated.

--

___
Python tracker 

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



[issue39669] macOS test failures

2020-02-17 Thread Ned Deily


Ned Deily  added the comment:

The importlib test failures have been showing up on the buildbots but haven't 
yet been triaged:

https://mail.python.org/archives/list/buildbot-sta...@python.org/thread/XMDX3AVR3HALZIPKBWB4WUV3FOAYHGUV/

It is referred here:
https://mail.python.org/archives/list/python-committ...@python.org/message/7HTKJO4APMRTLGUB2N5TGJ6CJBVR3UZX/

The initial messages are a build warning just indicating that tkinter can't be 
built on this system with the current Apple-supplied Tk, a long-standing issue.

--

___
Python tracker 

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



[issue39669] macOS test failures

2020-02-17 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue39669] macOS test failures

2020-02-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Same failures for pr-18539.

--
nosy: +vstinner

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2020-02-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Thank you for tracking this down.  The comment was on #32989.

--
nosy:  -miss-islington
versions: +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



[issue39669] macOS test failures

2020-02-17 Thread Terry J. Reedy


New submission from Terry J. Reedy :

macOS test failed twice for PR-18536, for reasons unrelated to the IDLE test 
additions.  Two pages gave completely different reasons.

https://github.com/python/cpython/pull/18536/checks?check_run_id=451798955

clang: warning: -framework Tk: 'linker' input unused 
[-Wunused-command-line-argument]
In file included from 
/Users/runner/runners/2.164.0/work/cpython/cpython/Modules/_tkinter.c:48:
/Applications/Xcode_11.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tk.h:86:11:
 fatal error: 'X11/Xlib.h' file not found
#   include 
^~~~
1 error generated.

Python build finished successfully!

But no tests are listed.

>From clicking '...' on above page, View raw logs,
https://pipelines.actions.githubusercontent.com/E9sxbx8BNoRYbzXilV3t7ZRT2AjSeiVsTIIDUiDv0jTXfwuZPt/_apis/pipelines/1/runs/4122/signedlogcontent/6?urlExpires=2020-02-18T02%3A39%3A17.4773408Z=HMACV1=ZpdM7bjMgqeUyUCyD4TLVZRYpMxqvYw%2BA9bEs0qCKfE%3D

2020-02-18T02:24:55.9857810Z 
==
2020-02-18T02:24:55.9858110Z FAIL: test_case_insensitivity 
(test.test_importlib.extension.test_case_sensitivity.Source_ExtensionModuleCaseSensitivityTest)
2020-02-18T02:24:55.9858780Z 
--
2020-02-18T02:24:55.9858930Z Traceback (most recent call last):
2020-02-18T02:24:55.9859090Z   File 
"/Users/runner/runners/2.164.0/work/cpython/cpython/Lib/test/test_importlib/extension/test_case_sensitivity.py",
 line 36, in test_case_insensitivity
2020-02-18T02:24:55.9859680Z self.assertTrue(hasattr(loader, 'load_module'))
2020-02-18T02:24:55.9859810Z AssertionError: False is not true

This happened with 2 subtests.
  
==
2020-02-18T02:24:55.9860160Z FAIL: test_insensitive 
(test.test_importlib.source.test_case_sensitivity.Frozen_CaseSensitivityTestPEP302)
2020-02-18T02:24:55.9860780Z 
--
2020-02-18T02:24:55.9860940Z Traceback (most recent call last):
2020-02-18T02:24:55.9861090Z   File 
"/Users/runner/runners/2.164.0/work/cpython/cpython/Lib/test/test_importlib/source/test_case_sensitivity.py",
 line 57, in test_insensitive
2020-02-18T02:24:55.9861400Z self.assertIsNotNone(insensitive)
2020-02-18T02:24:55.9861530Z AssertionError: unexpectedly None

4 subtests failed.

--
components: Tests, macOS
messages: 362170
nosy: lukasz.langa, ned.deily, ronaldoussoren, terry.reedy
priority: normal
severity: normal
status: open
title: macOS test failures
type: behavior
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



[issue39651] Exceptions raised by EventLoop.call_soon_threadsafe

2020-02-17 Thread Michael Hall


Change by Michael Hall :


--
nosy: +mikeshardmind

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2020-02-17 Thread miss-islington


miss-islington  added the comment:


New changeset fde0041089de2d13e7c473200fb74d3956203987 by Miss Islington (bot) 
in branch '3.7':
bpo-39663: IDLE: Add additional tests for pyparse (GH-18536)
https://github.com/python/cpython/commit/fde0041089de2d13e7c473200fb74d3956203987


--
nosy: +miss-islington

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2020-02-17 Thread miss-islington


miss-islington  added the comment:


New changeset 7fd752c1bc637aeca2bd122d07c0ebc379d0d8ca by Miss Islington (bot) 
in branch '3.8':
bpo-39663: IDLE: Add additional tests for pyparse (GH-18536)
https://github.com/python/cpython/commit/7fd752c1bc637aeca2bd122d07c0ebc379d0d8ca


--

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2020-02-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17918
pull_request: https://github.com/python/cpython/pull/18541

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2020-02-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17919
pull_request: https://github.com/python/cpython/pull/18542

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2020-02-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset ffda25f6b825f3dee493b6f0746266a4dd6989f0 by Cheryl Sabella in 
branch 'master':
bpo-39663: IDLE: Add additional tests for pyparse (GH-18536)
https://github.com/python/cpython/commit/ffda25f6b825f3dee493b6f0746266a4dd6989f0


--

___
Python tracker 

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



[issue39573] Make PyObject an opaque structure in the limited C API

2020-02-17 Thread Andy Lester


Andy Lester  added the comment:

> Would you mind to explain how it's an issue to modify PyObject* temporarily 
> during a function call?

It's not a problem to modify the PyObject* during a function call.  However, 
many functions don't need to modify the object, but are still taking non-const 
PyObject* arguments.

For example if I have this code:

if (Py_TYPE(deque) == _type) {

That doesn't modify deque to check the type, but because Py_TYPE casts away the 
constness, deque can't be a const object.

However, with the new Py_IS_TYPE function:

if (Py_IS_TYPE(deque, _type)) {

and these two changes:

-static inline int _Py_IS_TYPE(PyObject *ob, PyTypeObject *type) {
+static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) {
 return ob->ob_type == type;
 }
-#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST(ob), type)
+#define Py_IS_TYPE(ob, type) _Py_IS_TYPE(((const PyObject*)(ob)), type)

the deque variable can be const.

Another example of a common pattern that I believe could benefit from this is 
Py_TYPE(ob)->tp_name.  That could be turned into Py_TYPE_NAME(ob) and that 
would allow the ob to be a const pointer. 

If we can keep functions that don't modify the object to accept const PyObject* 
it will help make things safer in the long run.

--

___
Python tracker 

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



[issue38857] AsyncMock issue with awaitable return_value/side_effect/wraps

2020-02-17 Thread Dima Tisnek

Dima Tisnek  added the comment:

Thank you for explanation, Jason!

I guess that the bug report and the patch were too technical for me to 
understand 

I'm happy with the behaviour in Python 3.8.1 and now I know it's going to stay, 
I'll just change the tests in our code base.

--

___
Python tracker 

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



[issue39628] msg.walk memory leak?

2020-02-17 Thread Abhilash Raj


Change by Abhilash Raj :


--
nosy: +maxking

___
Python tracker 

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



[issue39668] segmentation fault on calling __reversed__()

2020-02-17 Thread Grzegorz Krasoń

New submission from Grzegorz Krasoń :

This causes segmentation fault:

list((lambda: None).__annotations__.__reversed__())

--
components: Interpreter Core
messages: 362164
nosy: Grzegorz Krasoń
priority: normal
severity: normal
status: open
title: segmentation fault on calling __reversed__()
type: crash
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



[issue39645] Expand concurrent.futures.Future's public API

2020-02-17 Thread Kyle Stanley


Kyle Stanley  added the comment:

Upon further consideration and based on recent developments in the python-ideas 
thread (mostly feedback from Antoine), I've decided to reduce the scope of this 
issue to remove future.set_state() and the *sync* parameters.

This leaves just future.state() and having the states as publicly accessible 
module-level constants.

--

___
Python tracker 

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



[issue39609] Set the thread_name_prefix for asyncio's default executor ThreadPoolExecutor

2020-02-17 Thread Caleb Hattingh


Caleb Hattingh  added the comment:

This change seems fine.

Markus,

I'm curious if there is a specific reason you prefer to use the default 
executor rather than replacing it with your own? Is it just convenience or are 
there other reasons?

--
nosy: +cjrh

___
Python tracker 

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



[issue12915] Add inspect.locate and inspect.resolve

2020-02-17 Thread Vinay Sajip


Vinay Sajip  added the comment:

> I'm not sure how to design the regex.

Did you not look at the PR I added to address this (Unicode chars), with a 
regex change? I added you as a reviewer.

--

___
Python tracker 

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



[issue38857] AsyncMock issue with awaitable return_value/side_effect/wraps

2020-02-17 Thread Jason Fried


Jason Fried  added the comment:

Its not possible to have it both ways.  Also it stinks too much of trying to 
guess. 

The root of your issue is you want a normal MagicMock not an AsyncMock. Its the 
automatic behavior of patch to pick AsyncMock vs MagicMock that is the heart of 
your issue.  This bug fix doesn't involve that behavior at all, and AsyncMock 
was measurably broken without the fix, in an unavoidable way.  Your breakage is 
avoidable by changes to how you patch.  

 with patch("bar", return_value=42)

To still do it the old way you would have to pass new_callable=MagicMock to 
patch.

--

___
Python tracker 

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



[issue39648] Update math.gcd() to accept "n" arguments.

2020-02-17 Thread Bernardo Sulzbach


Bernardo Sulzbach  added the comment:

I think this might make sense because gcd() could have some optimizations for n 
> 2, such as sorting the numbers and starting by the smallest elements.

However, I don't think gcd() and lcm() with more than two arguments are 
frequent use cases.

--
nosy: +BernardoSulzbach

___
Python tracker 

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



[issue39667] Update zipfile.Path with zipp 3.0

2020-02-17 Thread Jason R. Coombs


Change by Jason R. Coombs :


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

___
Python tracker 

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



[issue39667] Update zipfile.Path with zipfile 3.0

2020-02-17 Thread Jason R. Coombs


New submission from Jason R. Coombs :

zipp 3.0 includes enhanced support for the .open() method as well as 
performance improvements in 2.2.1 
(https://zipp.readthedocs.io/en/latest/history.html).

--
components: Library (Lib)
messages: 362158
nosy: jaraco
priority: normal
severity: normal
status: open
title: Update zipfile.Path with zipfile 3.0
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



[issue39667] Update zipfile.Path with zipp 3.0

2020-02-17 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
title: Update zipfile.Path with zipfile 3.0 -> Update zipfile.Path with zipp 3.0

___
Python tracker 

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



[issue39659] pathlib calls `os.getcwd()` without using accessor

2020-02-17 Thread Barney Gale


Barney Gale  added the comment:

Those methods are non-pure, i.e. part of `Path` but not `PurePath`. Only impure 
paths have accessors. The `_Accessor` docstring says: "an accessor implements a 
particular (system-specific or not) way of accessing paths on the filesystem". 
This abstraction is pretty pointless if covers `os.readlink()` but not 
`os.getcwd()`!

--

___
Python tracker 

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



Re: insert data in python script

2020-02-17 Thread DL Neil via Python-list

Please help us to help you!
1 is all of this code in a single file or spread across (at least) two 
modules? What are their names? What is the directory structure?

2 copy-paste the actual error message received.


It works for me!
1 not knowing your circumstances, I put all the code in one file
2 updated one line (possibly due to above)

# methane = preos.Molecule("methane", -82.59 + 273.15, 45.99, 0.011)
methane = Molecule("methane", -82.59 + 273.15, 45.99, 0.011)

dn $ python3 Projects/molecule.py
Molecule: methane.
Critical Temperature = 190.6 K
Critical Pressure = 46.0 bar.
Accentric factor = 0.011000


NB if the bulk of the code is stored in a module named preos.py then it 
is necessary to first:


import peos

and restore the above change.

NBB under such conditions peos.py must be located in the file-system 
where the 'mainline' can find (and import) it!

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


[issue39661] TimedRotatingFileHandler doesn’t handle DST switch with daily rollover

2020-02-17 Thread Joe Cool


Joe Cool  added the comment:

Never mind. I was looking for the DST code in computeRollover, and I found it 
in doRollover.

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



Re: Can anyone share experience about python backend developer?

2020-02-17 Thread DL Neil via Python-list

On 17/02/20 11:11 PM, lampahome wrote:

I have 3+years developer experience in python, but I always develop
about peer-to-peer service. Have no backend experience in python.

But now I want to change to backend engineer, somebody shares their
job is to do like
1. Develop customize API to receive data from global
2. Develop tools with k8s
3. Experience about NoSQL

After I heard above, it seems wide range and hard to start from scratch.

Without comparing performance with other languages, how to dig into
backend development?(Or some framework could help me?)



Suggest a review of edX's and Coursera's (and possibly others) on-line 
training courses. IIRC there's at least one that aims specifically at 
the 'back-end' stack.

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


Interpreter Python 3.8 not there to select from PyCharm

2020-02-17 Thread Maxime Albi
I'm very new to Python and wanting to learn the basics.
I downloaded and installed Python 3.8 and PyCharm for my Windows 10 machine.  
All good.

Launched PyCharm and I started a new Project and tried to select an 
'interpreter' such as Python 3.8 but no interpreter was available for me to 
select from the down arrow menu ..!?!?

Any settings I need to do ??

Thanks,
Maxime

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


[issue39662] Characters are garbled when displaying Byte data

2020-02-17 Thread Eric V. Smith


Change by Eric V. Smith :


--
status: open -> pending

___
Python tracker 

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



Re: I can't access dataframe fields

2020-02-17 Thread Markos

Hi MRAB,

I changed last_cluster to tuple(last_cluster).

From:

print (updated_distance_matrix_df.loc [clusters [i], last_cluster])

to

print (updated_distance_matrix_df.loc [clusters [i], tuple(last_cluster)])

And worked.

Thank you,

Markos


Em 15-02-2020 23:36, MRAB escreveu:

On 2020-02-16 00:50, Markos wrote:

Hi all,

I created the following data frame (updated_distance_matrix)

   P1    P2    P4    P5 (P3, P6)
P1 0,00 0,244307 0,367696 0,341760 0
P2 0.234307 0.00 0.194165 0.1443178 0
P4 0.366969 0.194165 0.00 0.284253 0
P5 0.341760 0.1443178 0.284253 0.00 0
(P3, P6) 0.00 0.00 0.00 0.00 0

I can change the fields of columns and rows P1-P5 without problems.

But when I try to access the fields of the row, or column, (P3, P6)

print (updated_distance_matrix_df.loc [clusters [i], last_cluster])

the message appears:

KeyError: 'the label [P3, P6] is not in the [index]'

The rows and columns have "(P3, P6)", but you're looking for "[P3, 
P6]". They aren't the same.



If I change find the "loc" by "at" method appears the error:

print (updated_distance_matrix_df.at [clusters [i], last_cluster])

TypeError: unhashable type: 'list'

Is it expecting a tuple instead of a list? Tuples are hashable, lists 
are not.



And if you simply leave:

print (updated_distance_matrix_df [clusters [i], last_cluster])

gives the error:

TypeError: unhashable type: 'list'

A last_cluster variable is of type list:

print (last_cluster, type (last_cluster))

['P3', 'P6'] 

And a variable cluster [i] is a string:

print (clusters [i], type (clusters [i]))

P5 

Any tip?

Thank you,



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


Re: fugacity cofficient

2020-02-17 Thread Peter Pearson
On 17 Feb 2020 18:40:00 GMT, Peter Pearson  wrote:
>
> Welcome, Alberto.
>
> Can you make this look more like a Python question and less like a
> do-my-homework question?  Show us what you've tried.

Sorry.   I see you already did exactly that.

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fugacity cofficient

2020-02-17 Thread Peter Pearson
On Sun, 16 Feb 2020 14:17:28 -0800 (PST), alberto wrote:
> Hi, 
> how I could realize a script to calculate fugacity coefficients
> with this formula
>
[snip]
>
> regards
>
> Alberto

Welcome, Alberto.

Can you make this look more like a Python question and less like a
do-my-homework question?  Show us what you've tried.

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue39382] abstract_issubclass() doesn't take bases tuple item ref

2020-02-17 Thread ppperry


ppperry  added the comment:

I posted a test on the PR

--
nosy: +ppperry

___
Python tracker 

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



fugacity cofficient

2020-02-17 Thread alberto
Hi, 
how I could realize a script to calculate fugacity coefficients
with this formula

https://wikimedia.org/api/rest_v1/media/math/render/svg/8743fb5a1e85edb8f4334fb7154727057f395eb8

in my input file.txt I have this data

#p z
10.0 0.9850
20.0 0.9703
30.0 0.9560
40.0 0.9421
50.0 0.9287

regards

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


[issue39666] IDLE: Factor out similar code in editor and hyperparser

2020-02-17 Thread Cheryl Sabella


Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue39665] Cryptic error message when creating types that don't include themselves in their MRO

2020-02-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, I got the same error message when tried to get such class.

super() is called implicitly by the type constructor to call __init_subclass__ 
on the parent of a newly generated type.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue36184] [EASY] test_gdb.test_threads() is specific to _POSIX_THREADS, fail on FreeBSD

2020-02-17 Thread Ananthakrishnan


Change by Ananthakrishnan :


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

___
Python tracker 

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



[issue39666] IDLE: Factor out similar code in editor and hyperparser

2020-02-17 Thread Cheryl Sabella


New submission from Cheryl Sabella :

Under issue32989, there was discussion about refactoring duplicate code between 
hyperparser and editor.

> Perhaps separate issue: the 'if use_ps1' statements in editor and 
> hyperparser, and a couple of lines before, is nearly identical, and could be 
> factored into a separate editor method that returns a parser instance ready 
> for analysis.  It could then be tested in isolation.  The method should 
> return a parser instance ready for analysis.

--
assignee: terry.reedy
components: IDLE
messages: 362153
nosy: cheryl.sabella, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Factor out similar code in editor and hyperparser
type: enhancement
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



[issue39665] Cryptic error message when creating types that don't include themselves in their MRO

2020-02-17 Thread ppperry


New submission from ppperry :

I was trying to create a class that didn't have any references to itself to 
test issue39382 and ran the following code:

class Meta(type):
def mro(cls):
return type.mro(cls)[1:]
class X(metaclass=Meta):
pass

This produced an extremely cryptic error message:

Traceback (most recent call last):
  File "", line 1, in 
class X(metaclass=Meta):
TypeError: super(type, obj): obj must be an instance or subtype of type

While what I am trying to do may well not be supported, the error message 
referencing the `super` function, which I didn't use, is not helpful.

--
components: Build, Interpreter Core
messages: 362152
nosy: ppperry
priority: normal
severity: normal
status: open
title: Cryptic error message when creating types that don't include themselves 
in their MRO
type: behavior
versions: 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



insert data in python script

2020-02-17 Thread alberto
Hi, 
I would use this script to evaluate fugacity coefficient with PENG-ROBINSON 
equation, but I don't understand the correct mode to insert data

import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import newton

R = 8.314e-5  # universal gas constant, m3-bar/K-mol
class Molecule:
"""
Store molecule info here
"""
def __init__(self, name, Tc, Pc, omega):
"""
Pass parameters desribing molecules
"""
#! name
self.name = name
#! Critical temperature (K)
self.Tc = Tc
#! Critical pressure (bar)
self.Pc = Pc
#! Accentric factor
self.omega = omega

def print_params(self):
"""
Print molecule parameters.
"""
print("""Molecule: %s.
\tCritical Temperature = %.1f K
\tCritical Pressure = %.1f bar.
\tAccentric factor = %f""" % (self.name, self.Tc, self.Pc, self.omega))

def preos(molecule, T, P, plotcubic=True, printresults=True):
"""
Peng-Robinson equation of state (PREOS)

http://en.wikipedia.org/wiki/Equation_of_state#Peng.E2.80.93Robinson_equation_of_state
:param molecule: Molecule molecule of interest
:param T: float temperature in Kelvin
:param P: float pressure in bar
:param plotcubic: bool plot cubic polynomial in compressibility factor
:param printresults: bool print off properties
Returns a Dict() of molecule properties at this T and P.
"""
# build params in PREOS
Tr = T / molecule.Tc  # reduced temperature
a = 0.457235 * R**2 * molecule.Tc**2 / molecule.Pc
b = 0.0777961 * R * molecule.Tc / molecule.Pc
kappa = 0.37464 + 1.54226 * molecule.omega - 0.26992 * molecule.omega**2
alpha = (1 + kappa * (1 - np.sqrt(Tr)))**2

A = a * alpha * P / R**2 / T**2
B = b * P / R / T

# build cubic polynomial
def g(z):
"""
Cubic polynomial in z from EOS. This should be zero.
:param z: float compressibility factor
"""
return z**3 - (1 - B) * z**2 + (A - 2*B - 3*B**2) * z - (
A * B - B**2 - B**3)

# Solve cubic polynomial for the compressibility factor
z = newton(g, 1.0)  # compressibility factor
rho = P / (R * T * z)  # density

# fugacity coefficient comes from an integration
fugacity_coeff = np.exp(z - 1 - np.log(z - B) - A / np.sqrt(8) / B * np.log(
(z + (1 + np.sqrt(2)) * B) / (z + (1 - np.sqrt(2)) * B)))

if printresults:
print("""PREOS calculation at
\t T = %.2f K
\t P = %.2f bar""" % (T, P))
print("\tCompressibility factor : ", z)
print("\tFugacity coefficient: ", fugacity_coeff)
print("\tFugacity at pressure %.3f bar = %.3f bar" % (
P, fugacity_coeff * P))
print("\tDensity: %f mol/m3" % rho)
print("\tMolar volume: %f L/mol" % (1.0 / rho * 1000))
print("\tDensity: %f v STP/v" % (rho * 22.4 / 1000))
print("\tDensity of ideal gas at same conditions: %f v STP/v" % (
rho * 22.4/ 1000 * z))

if plotcubic:
# Plot the cubic equation to visualize the roots
zz = np.linspace(0, 1.5)  # array for plotting

plt.figure()
plt.plot(zz, g(zz), color='k')
plt.xlabel('Compressibility, $z$')
plt.ylabel('Cubic $g(z)$')
plt.axvline(x=z)
plt.axhline(y=0)
plt.title('Root found @ z = %.2f' % z)
plt.show()
return {"density(mol/m3)": rho, "fugacity_coefficient": fugacity_coeff,
"compressibility_factor": z, "fugacity(bar)": fugacity_coeff * P,
"molar_volume(L/mol)": 1.0 / rho * 1000.0}

def preos_reverse(molecule, T, f, plotcubic=False, printresults=True):
"""
Reverse Peng-Robinson equation of state (PREOS) to obtain pressure for a 
particular fugacity
:param molecule: Molecule molecule of interest
:param T: float temperature in Kelvin
:param f: float fugacity in bar
:param plotcubic: bool plot cubic polynomial in compressibility factor
:param printresults: bool print off properties
Returns a Dict() of molecule properties at this T and f.
"""
# build function to minimize: difference between desired fugacity and that 
obtained from preos
def g(P):
"""
:param P: pressure
"""
return (f - preos(molecule, T, P, plotcubic=False, 
printresults=False)["fugacity(bar)"])

# Solve preos for the pressure
P = newton(g, f)  # pressure

# Obtain remaining parameters
pars = preos(molecule, T, P, plotcubic=plotcubic, printresults=printresults)
rho = pars["density(mol/m3)"]
fugacity_coeff = pars["fugacity_coefficient"]
z = pars["compressibility_factor"]

return {"density(mol/m3)": rho, "fugacity_coefficient": fugacity_coeff,
"compressibility_factor": z, "pressure(bar)": P,
"molar_volume(L/mol)": 1.0 / rho * 1000.0}

# TODO: Implement mixture in object-oriented way 

[issue9182] document “--” as a way to distinguish option w/ narg='+' from positional argument in argparse

2020-02-17 Thread Ananthakrishnan


Ananthakrishnan  added the comment:

Is this issue still needed?
Can I add a pull request for this.

--
nosy: +Ananthakrishnan

___
Python tracker 

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



[issue39664] Improve test coverage for operator module

2020-02-17 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue39664] Improve test coverage for operator module

2020-02-17 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

This ticket adds tests for operator module where some of the parts where not 
tested. Current coverage stands at 96.23% [0]. The added tests will get it 
closer to 100% and will help in testing the Python implementation of operator 
module.

[0] https://codecov.io/gh/python/cpython/branch/master/history/Lib/operator.py

--
components: Tests
messages: 362150
nosy: xtreak
priority: normal
severity: normal
status: open
title: Improve test coverage for operator module
type: behavior
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



[issue39661] TimedRotatingFileHandler doesn’t handle DST switch with daily rollover

2020-02-17 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2020-02-17 Thread Cheryl Sabella


Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue39663] IDLE: Add additional tests for pyparse

2020-02-17 Thread Cheryl Sabella


New submission from Cheryl Sabella :

Per msg313179, Terry asked to see tests for when the find_good_parse_start() 
call returns 0 instead of None.  There are two cases when a 0 might be returned:

1.  If the code is on the first line in the editor beginning with one of the 
matching keywords and ending in ":\n", such as "def spam():\n".
2.  If the code on the first line is entered as "def spam(", then the 
hyperparser adds the " \n" in its call to set_code and find_good_parse_start 
returns a 0.

--
assignee: terry.reedy
components: IDLE
messages: 362149
nosy: cheryl.sabella, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Add additional tests for pyparse
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



[issue39662] Characters are garbled when displaying Byte data

2020-02-17 Thread Eric V. Smith


Eric V. Smith  added the comment:

How do you know that isn't what is coming in over the serial port? I don't see 
any indication that this is a bug in python.

We can't really help you here with this sort of problem. I suggest you take 
this to the python-list mailing list: 
https://mail.python.org/mailman/listinfo/python-list

--
nosy: +eric.smith

___
Python tracker 

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



[issue39646] compile warning in unicodeobject.c

2020-02-17 Thread hai shi


hai shi  added the comment:

you are welcome ;0

--

___
Python tracker 

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



[issue39662] Characters are garbled when displaying Byte data

2020-02-17 Thread 福永陽平

New submission from 福永陽平 :

Hex data is garbled when displaying received data from serial.

--- code ---
recvMessage = serialPort.readline()
print(recvMessage, end="\r\n")


--- result ---
b'ERXUDP FE80::::0280:8700:3015:64F5 
FE80::::021D:1290:0003:8331 0E1A 0E1A 00808700301564F5 1 0012 
\x10\x81\x00\x01\x02\x88\x01\x05\xff\x01r\x01\xe7\x04\x00\x00\x02\x04\r\n'
--

Mysterious value of 0x01r.
When the corresponding value is judged, it becomes 0x72.

The correct behavior is...
--- correct result ---
b'ERXUDP FE80::::0280:8700:3015:64F5 
FE80::::021D:1290:0003:8331 0E1A 0E1A 00808700301564F5 1 0012 
\x10\x81\x00\x01\x02\x88\x01\x05\xff\x72\x01\xe7\x04\x00\x00\x02\x04\r\n'
--

--
components: IO
messages: 362145
nosy: 福永陽平
priority: normal
severity: normal
status: open
title: Characters are garbled when displaying Byte data
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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 4c1b6a6f4fc46add0097efb3026cf3f0c89f88a2 by Hai Shi in branch 
'master':
bpo-1635741: Port _abc extension to multiphase initialization (PEP 489) 
(GH-18030)
https://github.com/python/cpython/commit/4c1b6a6f4fc46add0097efb3026cf3f0c89f88a2


--

___
Python tracker 

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



[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:

Do you want to propose to write a PR to fix this issue?

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7d7956833cc37a9d42807cbfeb7dcc041970f579 by Hai Shi in branch 
'master':
bpo-1635741: Port _contextvars module to multiphase initialization (PEP 489) 
(GH-18374)
https://github.com/python/cpython/commit/7d7956833cc37a9d42807cbfeb7dcc041970f579


--

___
Python tracker 

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



[issue39646] compile warning in unicodeobject.c

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:

Yeah, I saw the warning, but it's a false alarm. Values are always initialized. 
Anyway. Thanks for fixing them ;-)

--
nosy: +vstinner
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Document PyUnicode_IsIdentifier() function

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3d235f5c5c5bce6e0caec44d2ce17f670c2ca2d7 by Hai Shi in branch 
'master':
bpo-39500: Fix compile warnings in unicodeobject.c (GH-18519)
https://github.com/python/cpython/commit/3d235f5c5c5bce6e0caec44d2ce17f670c2ca2d7


--

___
Python tracker 

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



[issue39661] TimedRotatingFileHandler doesn’t handle DST switch with daily rollover

2020-02-17 Thread Joe Cool

New submission from Joe Cool :

TimedRotatingFileHandler doesn’t handle the switch to/from DST when using 
daily/midnight rotation. It does not adjust the rollover time so the rollover 
will be off by an hour. 

Parameters: when=‘midnight’, utc=False

--
components: Library (Lib)
messages: 362140
nosy: snoopyjc
priority: normal
severity: normal
status: open
title: TimedRotatingFileHandler doesn’t handle DST switch with daily rollover
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



Re: What I learned today

2020-02-17 Thread 황병희
r...@zedat.fu-berlin.de (Stefan Ram) writes:

>   ...
>   But the book told me that you can unzip using ... »zip« again!
>
> z = zip( x, y )
> a, b = zip( *z )
> print( a )
>   ('y', 'n', 'a', 'n', 't')
> print( b )
> (4, 2, 7, 3, 1)
>
>   Wow!

Usally i use zip so many, thanks for tip^^^

Sincerely, Byung-Hee

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


[issue39648] Update math.gcd() to accept "n" arguments.

2020-02-17 Thread Ananthakrishnan


Ananthakrishnan  added the comment:

It should take variable number of positional arguments.
it should return:
>>math.gcd()
0
>>math.gcd(8)
8
>>math.gcd(-8)
8

--

___
Python tracker 

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



[issue39659] pathlib calls `os.getcwd()` without using accessor

2020-02-17 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Sorry, I cannot catch what is the problem of not use _Accesor on PurePath class

--
nosy: +eamanu

___
Python tracker 

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



[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-17 Thread Ben Boeckel


Ben Boeckel  added the comment:

> The paths are not user provided: they are hardcoded paths from the sysconfig 
> module:

No, those paths are the *replacement* values, not the input. From the trace 
docs:

>   trace.py -c -f counts --ignore-dir '$prefix' spam.py eggs

This is the string where `$prefix` is replaced with the value retrieved from 
`sysconfig`.

--

___
Python tracker 

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



[issue37096] Add large-file tests for modules using sendfile(2)

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:

I close the issue. The test was fixed in bpo-39488:

commit b39fb8e847ac59b539ad7e93df91c1709815180e
Author: Giampaolo Rodola 
Date:   Wed Feb 5 18:20:52 2020 +0100

bpo-39488: Skip test_largefile tests if not enough disk space (GH-18261)

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue39657] Bezout and Chinese Remainder Theorem in the Standard Library?

2020-02-17 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Should something like the following go in the standard library, most likely 
> in the math module?

I'm not keen. Granted that the math module has exceeded its original remit of 
"wrappers for libm", but even so, I'd prefer to try to limit it to a basic set 
of building blocks. For me, things like CRT and xgcd go beyond that.

I'd suggest that for now, the right place for this sort of thing would be a 
PyPI library for elementary number theory. That library could include probably 
primality testing, basic factoring, continued fractions, primitive root 
finding, and other elementary number theory topics.

--
nosy: +mark.dickinson

___
Python tracker 

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



Can anyone share experience about python backend developer?

2020-02-17 Thread lampahome
I have 3+years developer experience in python, but I always develop
about peer-to-peer service. Have no backend experience in python.

But now I want to change to backend engineer, somebody shares their
job is to do like
1. Develop customize API to receive data from global
2. Develop tools with k8s
3. Experience about NoSQL

After I heard above, it seems wide range and hard to start from scratch.

Without comparing performance with other languages, how to dig into
backend development?(Or some framework could help me?)

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


[issue39573] Make PyObject an opaque structure in the limited C API

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1b55b65638254aa78b005fbf0b71fb02499f1852 by Dong-hee Na in branch 
'master':
bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521)
https://github.com/python/cpython/commit/1b55b65638254aa78b005fbf0b71fb02499f1852


--

___
Python tracker 

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



[issue12915] Add inspect.locate and inspect.resolve

2020-02-17 Thread STINNER Victor

STINNER Victor  added the comment:

I reopen the issue to discuss the non-ASCII identifiers.

Currently, the code uses [a-z_]\w*, but "é" is a valid Python module name for 
example:

$ echo 'print("here")' > é.py
$ python3 -c 'import é'
here

I'm not sure how to design the regex. I just reported a potential issue ;-) See 
the PEP 3131 and str.isidentifier() method:
https://docs.python.org/dev/library/stdtypes.html#str.isidentifier

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue39573] Make PyObject an opaque structure in the limited C API

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:

> Getting away from Py_TYPE(op) would also mean a move to making the internals 
> const-correct.

Would you mind to explain how it's an issue to modify PyObject* temporarily 
during a function call? It's common to increase the object reference count to 
ensure that it doesn't go even while we use it.

--

___
Python tracker 

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



[issue39625] Traceback needs more details

2020-02-17 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



[issue39624] Trace greedy replaces $prefix and $exec_prefix

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:

> These should *not* be replaced:
>
> r"not/a/$prefix"
> r"$prefix spacevar/subdir"

Honestly, I don't see an issue to replace $prefix in these examples.

These examples seem artificial. The paths are not user provided: they are 
hardcoded paths from the sysconfig module:

if opts.ignore_dir:
_prefix = sysconfig.get_path("stdlib")
_exec_prefix = sysconfig.get_path("platstdlib")

I'm not even sure if it's worth it to fix this issue, it's unclear to me how 
you could get r"$prefixvar/subdir" from sysconfig.get_path("stdlib").

--

___
Python tracker 

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



[issue5537] LWPCookieJar cannot handle cookies with expirations of 2038 or greater on 32-bit platforms

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:

@Paul Ganssle: it's a little sad that I have work around 
datetime.datetime.utcfromtimestamp() function to avoid an OverflowError 
exception: msg361972.

Should we fix utcfromtimestamp() internally to avoid the OverflowError, rather 
than only fixing the http.cookiejar module?

--
nosy: +p-ganssle

___
Python tracker 

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



[issue34822] Simplify AST for slices

2020-02-17 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



[issue39453] Use-after-free in list contain

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Dong-hee Na for the fix.

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



[issue39453] Use-after-free in list contain

2020-02-17 Thread miss-islington


miss-islington  added the comment:


New changeset 3c57ca699910be74e7cf67d747b24bbc486932f1 by Miss Islington (bot) 
in branch '3.7':
[3.8] bpo-39453: Fix contains method of list to hold strong references 
(GH-18204)
https://github.com/python/cpython/commit/3c57ca699910be74e7cf67d747b24bbc486932f1


--

___
Python tracker 

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



[issue39098] OSError: handle closed, ProcessPoolExecutor shutdown(wait=False)

2020-02-17 Thread Patrick Buxton


Patrick Buxton  added the comment:

This should be fixed with https://github.com/python/cpython/pull/17670 for 
https://bugs.python.org/issue39104, but only for version 3.9 as no backport!!

--

___
Python tracker 

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



[issue39647] Update doc of init_config.rst

2020-02-17 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Make release and debug ABI compatible

___
Python tracker 

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



[issue36465] Make release and debug ABI compatible

2020-02-17 Thread hai shi


Change by hai shi :


--
pull_requests: +17912
pull_request: https://github.com/python/cpython/pull/18520

___
Python tracker 

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



[issue36465] Make release and debug ABI compatible

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a7847590f07655e794d7c62130aea245a110acef by Hai Shi in branch 
'master':
bpo-36465: Update doc of init_config.rst (GH-18520)
https://github.com/python/cpython/commit/a7847590f07655e794d7c62130aea245a110acef


--

___
Python tracker 

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



[issue39453] Use-after-free in list contain

2020-02-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17911
pull_request: https://github.com/python/cpython/pull/18535

___
Python tracker 

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



[issue39453] Use-after-free in list contain

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f64abd10563c25a94011f9e3335fd8a1cf47c205 by Dong-hee Na in branch 
'3.8':
[3.8] bpo-39453: Fix contains method of list to hold strong references 
(GH-18204)
https://github.com/python/cpython/commit/f64abd10563c25a94011f9e3335fd8a1cf47c205


--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b2b6e27bcab44e914d0a0b170e915d6f1604a76d by Hai Shi in branch 
'master':
bpo-1635741: Port _crypt extension module to multiphase initialization (PEP 
489) (GH-18404)
https://github.com/python/cpython/commit/b2b6e27bcab44e914d0a0b170e915d6f1604a76d


--

___
Python tracker 

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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2020-02-17 Thread miss-islington


miss-islington  added the comment:


New changeset 988aeba94bf1dab81dd52fc7b02dca7a57ea8ba0 by Miss Islington (bot) 
in branch '3.8':
bpo-32892: Update the documentation for handling constants in AST. (GH-18514)
https://github.com/python/cpython/commit/988aeba94bf1dab81dd52fc7b02dca7a57ea8ba0


--
nosy: +miss-islington

___
Python tracker 

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



[issue38691] [easy] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-17 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



[issue38691] [easy] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-17 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d83b6600b25487e4ebffd7949d0f478de9538875 by idomic in branch 
'master':
bpo-38691 Added a switch to ignore PYTHONCASEOK when -E or -I flags passed 
(#18314)
https://github.com/python/cpython/commit/d83b6600b25487e4ebffd7949d0f478de9538875


--

___
Python tracker 

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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2020-02-17 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17910
pull_request: https://github.com/python/cpython/pull/18534

___
Python tracker 

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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2020-02-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 85a2eef473a2c9ed3ab9c6ee339891fe99adbbc9 by Serhiy Storchaka in 
branch 'master':
bpo-32892: Update the documentation for handling constants in AST. (GH-18514)
https://github.com/python/cpython/commit/85a2eef473a2c9ed3ab9c6ee339891fe99adbbc9


--

___
Python tracker 

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