[issue15443] datetime module has no support for nanoseconds

2021-04-07 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

> In telemetry,

a nanosecond often translates to about a foot and 5 hours gets you to Pluto.  
Telemetry is exactly an application where absolute timestamps rarely make any 
sense.

--

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



[issue15443] datetime module has no support for nanoseconds

2021-04-07 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

Is there high enough demand for nanoseconds in datetime and time instances?

How often nanosecond timestamps contain anything other than 0s or garbage in 
the last three digits?

In my experience, all people want to do with such timestamps is to convert them 
to something expressed in hours, minutes and seconds rather than just a huge 
number of seconds and back without loosing the value.

A timedelta is almost always a decent replacement for either datetime or time 
in those cases and sometimes it is even preferable because arithmetically it is 
closer to numbers.

--

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



[issue15443] datetime module has no support for nanoseconds

2021-04-07 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

@pganssle - let's keep the substantive discussions in the tracker so that they 
are not lost on github.  You wrote:

"""
what is still blocking / needs to be done on this? Beta freeze for Python 3.10 
is coming up at the beginning of May and I think we may have enough time to get 
this in before then. Probably would have been better to get it into an alpha 
release, but if we miss beta freeze it'll get pushed to 3.11, and I do think 
that nanosecond support is a desirable feature for a lot of people.

It might be good for us to get an explicit "to-do" list of concerns to be 
addressed before this can be merged.
"""

I don't think full nanosecond support is feasible to complete in the remaining 
weeks, but we can try to add nanoseconds to timedelta only.  The mixed datetime 
+ timedelta ops will still truncate, but many time-related  operations will be 
enabled.

I would even argue that when nanoseconds precision is required, it is more 
often intervals no longer than a few days and rarely a specific point in time.

--
versions: +Python 3.10 -Python 3.7

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



[issue41904] datetime.datetime.today makes no sense and should be removed

2020-10-14 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

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



[issue41904] datetime.datetime.today makes no sense and should be removed

2020-10-14 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

I agree that having some of datetime.now([tz]) functionality replicated in 
datetime.today() makes little sense.  However, the presence of this method in 
datetime class is a consequence of datetime being a subclass of the date class. 
The latter was a design mistake IMO, but as other pointed out it is too late to 
do anything about it.

--
assignee:  -> belopolsky

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



[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
resolution: wont fix -> duplicate

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



[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

This is a duplicate of issue 33293.

--
superseder:  -> Using datetime.datetime.utcnow().timestamp() in Python3.6.0 
can't get correct UTC timestamp.

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



[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-15 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am sure this has been reported before – I will try to find the relevant 
issue.  This behavior is correct and documented.  The only improvement that we 
can consider is to make it more explicit that utcnow is deprecated and the 
correct way to obtain the UTC timestamp is

datetime.now(timezone.utc).timestamp()

--

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



[issue26460] datetime.strptime without a year fails on Feb 29

2020-03-02 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

> On Mar 2, 2020, at 6:33 PM, Gregory P. Smith  wrote:
> 
> Change that default to any old year with a leap year (1904?)

In the 21st century, the year 2000 default makes much more sense than 1900. 
Luckily 2000 is also a leap year.

--

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



[issue39680] datetime.astimezone() method does not handle invalid local times as required by PEP 495

2020-02-18 Thread Alexander Belopolsky


New submission from Alexander Belopolsky :

Let g be a an invalid time in New York spring-forward gap:

>>> g = datetime(2020, 3, 8, 2, 30)

According to PEP 495, conversion of such instance to UTC should return a value 
that corresponds to a valid local time greater than g, but

>>> print(g.astimezone(timezone.utc).astimezone())
2020-03-08 01:30:00-05:00

Also, conversion of the same instance with fold=1 to UTC and back should 
produce a lesser time, but

>>> print(g.replace(fold=1).astimezone(timezone.utc).astimezone())
2020-03-08 03:30:00-04:00

Note that conversion to and from timestamp works correctly:

>>> print(datetime.fromtimestamp(g.timestamp()))
2020-03-08 03:30:00
>>> print(datetime.fromtimestamp(g.replace(fold=1).timestamp()))
2020-03-08 01:30:00

--
assignee: belopolsky
messages: 362241
nosy: belopolsky, p-ganssle
priority: normal
severity: normal
status: open
title: datetime.astimezone() method does not handle invalid local times as 
required by PEP 495
type: behavior
versions: Python 3.9

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



[issue30155] Add ability to get/set tzinfo on datetime instances in C API

2019-12-09 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
dependencies: +Add timezone support to datetime C API

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



[issue36240] Definitions of time

2019-03-11 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

How about replacing "formerly known as Greenwich Mean Time, or GMT" with "which 
superseded Greenwich Mean Time or GMT as the basis of international 
timekeeping"?

I don't think Python reference manual is the right place to explain the 
difference between UTC and GMT, but since we have time.gmtime() function, GMT 
should still be mentioned.

--

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



[issue35364] Datetime “fromtimestamp()” ignores inheritance if timezone is not None

2019-02-04 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 89427cd0feae25bbc8693abdccfa6a8c81a2689c by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
bpo-32417: Make timedelta arithmetic respect subclasses (#10902)
https://github.com/python/cpython/commit/89427cd0feae25bbc8693abdccfa6a8c81a2689c


--
nosy: +belopolsky

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



[issue32417] fromutc does not respect datetime subclasses

2019-02-04 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 89427cd0feae25bbc8693abdccfa6a8c81a2689c by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
bpo-32417: Make timedelta arithmetic respect subclasses (#10902)
https://github.com/python/cpython/commit/89427cd0feae25bbc8693abdccfa6a8c81a2689c


--

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



[issue17005] Add a topological sort algorithm

2019-01-16 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

Here is an implementation that I've used for years. It is somewhat shorter than 
the one in PR 11583:

class CycleError(LogicalError, ValueError):
"""dependencies cycle detected

"""


def tsort(pairs):
"""topological sort

Just like unix tsort(1)

>>> tsort([(1, 2), (7, 8), (8, 10), (7, 4), (2, 3), (4, 10)])
[1, 7, 2, 8, 4, 3, 10]
>>> try:
... tsort([(1,2), (2,1)])
... except CycleError as e:
... print(e)
([], Counter({1: 1, 2: 1}), {1: [2], 2: [1]})
"""
# inspired by 
http://mail.python.org/pipermail/python-list/1999-July/002831.html
successors = {}
predecessor_counts = collections.Counter()
for x, y in pairs:
successors.setdefault(x, []).append(y)
predecessor_counts.setdefault(x, 0)
predecessor_counts[y] += 1
ordered = [x for x in predecessor_counts
   if predecessor_counts[x] == 0]
for x in ordered:
del predecessor_counts[x]
for y in successors.get(x, ()):
predecessor_counts[y] -= 1
if predecessor_counts[y] == 0:
ordered.append(y)
if predecessor_counts:
raise CycleError(ordered, predecessor_counts, successors)
return ordered

--

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



[issue20371] datetime.datetime.replace bypasses a subclass's __new__

2018-12-04 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> datetime.py implementation of .replace inconsistent with C 
implementation

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



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> On Dec 4, 2018, at 10:27 AM, Şahin  wrote:
> 
> Is there anything similar to this for "public API functions"?

Yes - read the reference manual. If the function is not there it is not public.

--

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



[issue9004] datetime.utctimetuple() should not set tm_isdst flag to 0

2018-12-03 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

I submitted Gaurav's patch as PR 10870.  Please review.

--

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



[issue9004] datetime.utctimetuple() should not set tm_isdst flag to 0

2018-12-03 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
pull_requests: +10105
stage: needs patch -> patch review

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



[issue33940] datetime.strptime have no directive to convert date values with Era and Time Zone name

2018-10-29 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
superseder:  -> %Z in strptime doesn't match EST and others

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



[issue33940] datetime.strptime have no directive to convert date values with Era and Time Zone name

2018-10-29 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

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



[issue33940] datetime.strptime have no directive to convert date values with Era and Time Zone name

2018-10-29 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

Since the Python datetime only supports dates within 0001-01-01 through 
-12-31 range, it is not clear how we can meaningfully support the AD/BC era 
designation.

Looking at man strftime page on my Mac, I see that they use every upper an 
lower case letter as a valid format specifier, but they still not have a letter 
code for AD/BC.  In the "BUGS" section they humorousely complain that "There is 
no conversion specification for the phase of the moon" which makes me think 
that the moon phase designations are higher on some people agenda than the era 
designations.

--

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



[issue22377] %Z in strptime doesn't match EST and others

2018-10-29 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

I think strptime should only accept %Z when it comes together with %z and not 
do any validation.

This is close to the current behavior.  %Z by itself is useless because even 
when it is accepted, the value is discarded:

>>> print(datetime.strptime('UTC', '%Z'))
1900-01-01 00:00:00

You have to use %z to get an aware datetime instance: 

>>> print(datetime.strptime('UTC+', '%Z%z'))
1900-01-01 00:00:00+00:00


The validation is already fairly lax:

>>> print(datetime.strptime('UTC+1234', '%Z%z'))
1900-01-01 00:00:00+12:34

I don't think this issue has anything to do with the availability of zoneinfo 
database.  Timezone abbreviations are often ambiguous and should only serve as 
a human-readable supplement to the UTC offset and cannot by itself be used as a 
TZ specification.

--

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



[issue34672] '%Z' strftime specifier never works with musl

2018-10-29 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

It looks like this issue has been fixed by GH-9288.  Can this be closed?  
Should we backport?

--

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



[issue34158] Documentation of datetime '%z' format code is odd

2018-10-05 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 92878829c31ab2fc71c60555ce87a5f6cbc876f0 by Alexander Belopolsky 
(Christophe Nanteuil) in branch 'master':
bpo-34158: Documentation UTC offset update (GH-8377)
https://github.com/python/cpython/commit/92878829c31ab2fc71c60555ce87a5f6cbc876f0


--
nosy: +belopolsky

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



[issue30140] Binary arithmetic does not always call subclasses first

2018-09-15 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
nosy: +belopolsky

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



[issue29097] [Windows] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2018-07-27 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 6ea8a3a0ebf840ca57b6dba9cad26fbb0ddaa5d4 by Alexander Belopolsky 
(Ammar Askar) in branch '3.6':
[3.6] bpo-29097: Forego fold detection on windows for low timestamp values 
(GH-2385) (GH-8498)
https://github.com/python/cpython/commit/6ea8a3a0ebf840ca57b6dba9cad26fbb0ddaa5d4


--

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



[issue29097] [Windows] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2018-07-25 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 973649342cee3869409f341ff0f0e3d2b1547c2a by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.7':
bpo-29097: Forego fold detection on windows for low timestamp values (GH-2385) 
(GH-8466)
https://github.com/python/cpython/commit/973649342cee3869409f341ff0f0e3d2b1547c2a


--

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



[issue29097] [Windows] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on Python 3.6

2018-07-25 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 96d1e69a12ed8ab80203277e1abdaf573457a964 by Alexander Belopolsky 
(Ammar Askar) in branch 'master':
bpo-29097: Forego fold detection on windows for low timestamp values (GH-2385)
https://github.com/python/cpython/commit/96d1e69a12ed8ab80203277e1abdaf573457a964


--

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



[issue32780] ctypes: memoryview gives incorrect PEP3118 format strings for both packed and unpacked structs

2018-07-08 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
assignee:  -> belopolsky

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



[issue32780] ctypes: memoryview gives incorrect PEP3118 format strings for both packed and unpacked structs

2018-07-08 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

Unfortunately, the PEP authors did very little in terms of implementing the PEP 
and neither CPython nor numpy has a fully compliant implementation.

--
nosy: +aerojockey, teoliphant

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



[issue34008] Do we support calling Py_Main() after Py_Initialize()?

2018-07-04 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
nosy: +belopolsky

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



[issue30516] Documentation for datetime substract operation incorrect?

2018-07-04 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


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

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



[issue30516] Documentation for datetime substract operation incorrect?

2018-07-04 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset a8bb18bbb9c286cfac5a0b8c8679c440e5c49305 by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.7':
bpo-30516: Fix documentation issue with -timedelta in datetime (GH-7348) 
(GH-8093)
https://github.com/python/cpython/commit/a8bb18bbb9c286cfac5a0b8c8679c440e5c49305


--

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



[issue30516] Documentation for datetime substract operation incorrect?

2018-07-04 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 55f39bdabc91b387c18451c78ee077e6d05d6cfe by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.6':
bpo-30516: Fix documentation issue with -timedelta in datetime (GH-7348) 
(GH-8092)
https://github.com/python/cpython/commit/55f39bdabc91b387c18451c78ee077e6d05d6cfe


--

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



[issue30516] Documentation for datetime substract operation incorrect?

2018-07-04 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 5b6e49a1393b3e2313471696e3568e26296137b4 by Alexander Belopolsky 
(Farhaan Bukhsh) in branch 'master':
bpo-30516: Fix documentation issue with -timedelta in datetime (GH-7348)
https://github.com/python/cpython/commit/5b6e49a1393b3e2313471696e3568e26296137b4


--

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



[issue33849] Caught infinite recursion resets the trace function

2018-06-12 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
resolution:  -> duplicate
superseder:  -> Tracing disabled when a recursion error is triggered (even if 
properly handled)

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



[issue33849] Caught infinite recursion resets the trace function

2018-06-12 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
stage: needs patch -> resolved
status: open -> closed

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



[issue33849] Caught infinite recursion resets the trace function

2018-06-12 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

It looks like this has been known for quite some time.  See issue10933.

--

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



[issue33849] Caught infinite recursion resets the trace function

2018-06-12 Thread Alexander Belopolsky


New submission from Alexander Belopolsky :

Consider the following code:

import sys

def trace(frame, event, arg):
pass

def f():
f()
sys.settrace(trace)
print(sys.gettrace())
try:
f()
except RuntimeError:
pass
print(sys.gettrace())

When I run it, I get


None

Apparently, the infinite recursion somehow resets the trace function.  This 
interferes with the coverage tools.

--
messages: 319409
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: Caught infinite recursion resets the trace function
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


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

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 1d4089b5d208ae6f0bd256304fd77f04c0b4fd41 by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.6':
bpo-33812: Corrected astimezone for naive datetimes. (GH-7578) (GH-7601)
https://github.com/python/cpython/commit/1d4089b5d208ae6f0bd256304fd77f04c0b4fd41


--

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 037e9125527d4a55af566f161c96a61b3c3fd998 by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.7':
bpo-33812: Corrected astimezone for naive datetimes. (GH-7578) (GH-7600)
https://github.com/python/cpython/commit/037e9125527d4a55af566f161c96a61b3c3fd998


--

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 877b23202b7e7d4f57b58504fd0eb886e8c0b377 by Alexander Belopolsky 
in branch 'master':
bpo-33812: Corrected astimezone for naive datetimes. (GH-7578)
https://github.com/python/cpython/commit/877b23202b7e7d4f57b58504fd0eb886e8c0b377


--

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
stage: patch review -> commit review
versions: +Python 3.6

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-09 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

Tim, given that I've updated the documentation, should we treat this as a bug 
fix or a feature?  Note that the type check is definitely a bug-fix (if not a 
security issue), but I clearly had a wrong definition of "naive" in mind when I 
was modifying astimezone to support naive instances.

In any case, it looks like a news entry is in order.

--

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-09 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
keywords: +patch
pull_requests: +7202
stage: needs patch -> patch review

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-08 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
assignee:  -> belopolsky
components: +Extension Modules, Library (Lib)
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.7, Python 3.8

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-08 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

So you are suggesting that my datetime(2000,1,1,tzinfo=TZ()) should behave as a 
naive instance, right?  Well, this would be a third behavior different from 
both current C and Python implementations:

>>> print(datetime(2000,1,1).astimezone(timezone.utc))
2000-01-01 05:00:00+00:00

(I am in US/Eastern timezone.)

--

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



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-08 Thread Alexander Belopolsky


New submission from Alexander Belopolsky :

Consider the following code:

$ cat bug.py
import sys
if len(sys.argv) > 1:
sys.modules['_datetime'] = None
from datetime import tzinfo, datetime, timezone

class TZ(tzinfo):
def utcoffset(self, t):
pass

print(datetime(2000,1,1,tzinfo=TZ()).astimezone(timezone.utc))

When running with no arguments (with C acceleration), I get

$ ./python.exe bug.py
2000-01-01 00:00:00+00:00

but the pure python code produces an error

$ ./python.exe bug.py pure
Traceback (most recent call last):
  File "bug.py", line 10, in 
print(datetime(2000,1,1,tzinfo=TZ()).astimezone(timezone.utc))
  File ".../Lib/datetime.py", line 1783, in astimezone
raise ValueError("astimezone() requires an aware datetime")
ValueError: astimezone() requires an aware datetime

Note that some kind of error is expected because TZ.utcoffset() returns None 
instead of a timedelta, but the error message produced by pure python code is 
confusing.

--
title: Different behavior betwee -> Different behavior between datetime.py and 
its C accelerator

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



[issue33812] Different behavior betwee

2018-06-08 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
nosy: belopolsky
priority: normal
severity: normal
status: open
title: Different behavior betwee

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



[issue33810] Remove unused code in datetime module

2018-06-08 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


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

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



[issue25283] Make tm_gmtoff and tm_zone available on all platforms

2018-06-08 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset bcb032e4acdebc043a7659a06e6037fe71020860 by Alexander Belopolsky 
in branch 'master':
bpo-33810 Remove unused code from datetime.py. (GH-7549)
https://github.com/python/cpython/commit/bcb032e4acdebc043a7659a06e6037fe71020860


--

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



[issue33810] Remove unused code in datetime module

2018-06-08 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset bcb032e4acdebc043a7659a06e6037fe71020860 by Alexander Belopolsky 
in branch 'master':
bpo-33810 Remove unused code from datetime.py. (GH-7549)
https://github.com/python/cpython/commit/bcb032e4acdebc043a7659a06e6037fe71020860


--

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



[issue25283] Make tm_gmtoff and tm_zone available on all platforms

2018-06-08 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
pull_requests: +7183

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



[issue33810] Remove unused code in datetime module

2018-06-08 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
keywords: +patch
pull_requests: +7182
stage: needs patch -> patch review

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



[issue33810] Remove unused code in datetime module

2018-06-08 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
components:  -Extension Modules

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



[issue33810] Remove unused code in datetime module

2018-06-08 Thread Alexander Belopolsky


New submission from Alexander Belopolsky :

Since implementation of issue 25283, the objects returned by time.localtime 
always have tm_zone and tm_gmtoff attributes, but the datetime module still has 
code that anticipates these attributes to be missing. [1]

[1]: 
https://github.com/python/cpython/blob/1cbdb2208aa309cf288ee0b53f0ecd85279bb934/Lib/datetime.py#L1763

--
assignee: belopolsky
components: Extension Modules, Library (Lib)
messages: 319110
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: Remove unused code in datetime module
type: resource usage
versions: Python 3.8

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



[issue28602] `tzinfo.fromutc()` fails when used for a fold-aware tzinfo implementation

2018-06-05 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

Paul,

In your opening post to this issue you suggested to change one line [1] in 
Lib/datetime.py from

dtdst = dt.dst()

to

dtdst = dt.replace(fold=1).dst()

This looks like a rather innocuous change, but it does not by itself make 
fromutc() return properly "enfolded" instances.  IIRC, the best algorithm that 
Tim and I were able to come up with to derive the fold value required something 
like six utcoffset() probes.

PR 7425 that you submitted looks somewhat involved.  Can you submit an 
equivalent datetime.py patch?

[1]: 
https://github.com/python/cpython/blob/c56b17bd8c7a3fd03859822246633d2c9586f8bd/Lib/datetime.py#L1125

--

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



[issue28602] `tzinfo.fromutc()` fails when used for a fold-aware tzinfo implementation

2018-06-05 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:

> it's actually possible to implement full `fold` support in a generic way 

I am aware of that.  In fact, some of the draft versions of PEP 495 
implementation did contain such code.  The problem is that any such 
tz.fromutc() implementation would necessarily change the behavior of the old 
programs.  Moreover, any implementation of tz.fromutc() in terms of 
tz.utcoffset() is more complicated and less efficient than code that he's 
direct access to a database of transition times.

--

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



[issue28602] `tzinfo.fromutc()` fails when used for a fold-aware tzinfo implementation

2018-06-04 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
stage:  -> needs patch
versions:  -Python 3.6, Python 3.7

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



[issue33701] test_datetime crashed (SIGSEGV) on Travis CI

2018-06-01 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
nosy: +belopolsky

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



[issue33649] asyncio docs overhaul

2018-06-01 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
nosy: +belopolsky

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



[issue33579] calendar.timegm not always an inverse of time.gmtime

2018-05-20 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

Well, even in non-POSIX mode timegm and gmtime are the inverse of one another 
in BSD.  The problem that you see stems from the fact that time.gmtime is 
implemented as a call to the namesake C function while calendar.timegm is 
implemented in pure Python. It would be reasonable to bring some consistency to 
this situation.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33579>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33541] Remove private and apparently unused __pad function

2018-05-20 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


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

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33541] Remove private and apparently unused __pad function

2018-05-20 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 89a25ce4fdb9c2a1a59d8cbfc498a2614b98e9ae by Alexander Belopolsky 
(Mario Corchero) in branch 'master':
bpo-33541: Remove unused __pad function (GH-4377)
https://github.com/python/cpython/commit/89a25ce4fdb9c2a1a59d8cbfc498a2614b98e9ae


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33541>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33579] calendar.timegm not always an inverse of time.gmtime

2018-05-20 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

I was able to reproduce this issue on Linux as follows

>>> import time, calendar, os
>>> os.environ['TZ'] = 'right/UTC'  # "right" timezones account for leap seconds
>>> time.tzset()
>>> calendar.timegm(time.gmtime(1234567899))
1234567875

This confirms Martin's insight that on the OP's system gmtime accounts for leap 
seconds.

There has been a general trend in Python to replace calls to system dependent 
functions in the time module with system independent reimplementations.  It is 
certainly possible to reimplement time.gmtime, but someone should champion this 
idea on python-dev.

--
assignee:  -> belopolsky
stage:  -> needs patch
type: behavior -> enhancement
versions: +Python 3.8

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33579>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32604] Expose the subinterpreters C-API in Python for testing use.

2018-05-16 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


--
nosy: +belopolsky

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32604>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8947] Provide as_integer_ratio() method to Decimal

2018-03-13 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

This issue has been superseded by #25928.

--
resolution: rejected -> duplicate
stage: patch review -> resolved
superseder:  -> Add Decimal.as_integer_ratio()

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue8947>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2018-03-01 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


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

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15873>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2018-03-01 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 0e06be836ca0d578cf9fc0c68979eb682c00f89c by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.7':
Add What's new entry for datetime.fromisoformat (GH-5559) (GH-5939)
https://github.com/python/cpython/commit/0e06be836ca0d578cf9fc0c68979eb682c00f89c


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15873>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10381] Add timezone support to datetime C API

2018-02-27 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset fff596f792a0752b0e571fa57809e5752aba6353 by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.7':
bpo-10381, bpo-32403: What's new entries for changes to datetime (gh-5814) 
(gh-5929)
https://github.com/python/cpython/commit/fff596f792a0752b0e571fa57809e5752aba6353


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue10381>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32403] date, time and datetime alternate constructors should take fast construction path

2018-02-27 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset fff596f792a0752b0e571fa57809e5752aba6353 by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.7':
bpo-10381, bpo-32403: What's new entries for changes to datetime (gh-5814) 
(gh-5929)
https://github.com/python/cpython/commit/fff596f792a0752b0e571fa57809e5752aba6353


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32403>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10381] Add timezone support to datetime C API

2018-02-27 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 5bd04f964b4f1bcdbd0fa36de04f087c2db07cfe by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
bpo-10381, bpo-32403: What's new entries for changes to datetime (gh-5814)
https://github.com/python/cpython/commit/5bd04f964b4f1bcdbd0fa36de04f087c2db07cfe


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue10381>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32403] date, time and datetime alternate constructors should take fast construction path

2018-02-27 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 5bd04f964b4f1bcdbd0fa36de04f087c2db07cfe by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
bpo-10381, bpo-32403: What's new entries for changes to datetime (gh-5814)
https://github.com/python/cpython/commit/5bd04f964b4f1bcdbd0fa36de04f087c2db07cfe


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32403>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2018-02-05 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 22864bc8e4a076bbac748ccda6c27f1ec41b53e7 by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
Add What's new entry for datetime.fromisoformat (#5559)
https://github.com/python/cpython/commit/22864bc8e4a076bbac748ccda6c27f1ec41b53e7


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15873>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10381] Add timezone support to datetime C API

2018-01-24 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


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

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue10381>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10381] Add timezone support to datetime C API

2018-01-24 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 04af5b1ba9eb546a29735fac6cb5298159069b53 by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
bpo-10381: Add timezone to datetime C API (#5032)
https://github.com/python/cpython/commit/04af5b1ba9eb546a29735fac6cb5298159069b53


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue10381>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32625] Update the dis module documentation to reflect switch to wordcode

2018-01-22 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


--
nosy: +vstinner

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32625] Update the dis module documentation to reflect switch to wordcode

2018-01-22 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

There is an uncommitted update for the EXTENDED_ARG opcode documentation 
attached to issue 27095 as mkfu4.patch by Demur Rumed.

--
nosy: +Demur Rumed

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32625] Update the dis module documentation to reflect switch to wordcode

2018-01-22 Thread Alexander Belopolsky

New submission from Alexander Belopolsky <alexander.belopol...@gmail.com>:

A switch to wordcode is implemented in Python 3.6, but the documentation in the 
dis module was mostly left unchanged.  See issue 26647, msg266388 and issue 
27095, msg268389.

--
assignee: docs@python
components: Documentation
messages: 310440
nosy: belopolsky, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: Update the dis module documentation to reflect switch to wordcode
versions: Python 3.7

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26647] ceval: use Wordcode, 16-bit bytecode

2018-01-22 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


--
components: +Interpreter Core -Documentation
stage: needs patch -> resolved

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue26647>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32403] date, time and datetime alternate constructors should take fast construction path

2018-01-16 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


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

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32403>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32404] fromtimestamp does not call __new__ in datetime subclasses

2018-01-16 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 9f1b7b93f5f0ef589e7b272e127cacf4ce5d23f1 by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
bpo-32403: Faster date and datetime constructors (#4993)
https://github.com/python/cpython/commit/9f1b7b93f5f0ef589e7b272e127cacf4ce5d23f1


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

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32404>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32403] date, time and datetime alternate constructors should take fast construction path

2018-01-16 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 9f1b7b93f5f0ef589e7b272e127cacf4ce5d23f1 by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
bpo-32403: Faster date and datetime constructors (#4993)
https://github.com/python/cpython/commit/9f1b7b93f5f0ef589e7b272e127cacf4ce5d23f1


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32403>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9325] Add an option to pdb/trace/profile to run library module as a script

2018-01-11 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


--
assignee: belopolsky -> 

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue9325>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32267] strptime misparses offsets with microsecond format

2018-01-09 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


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

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32267>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32522] Add precision argument to datetime.now

2018-01-09 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

> (And, honestly, `dateutil` would provide a version-independent backport 
> anyway).

Why not start with that?  Remember: python standard library is where code goes 
to die.  By implementing this feature in dateutil you will not be tied to 
relatively slow python release schedule.  Of course, you cannot change 
datetime.now from a 3rd party module, but you can provide your own dateutil.now 
with the desired features.

The only downside I see is that you will need to copy much of datetime.now 
implementation which is rather convoluted.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32522>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32522] Add precision argument to datetime.now

2018-01-09 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

I am about +0 on adding a keyword argument to datetime.now.  Note that as I 
wrote in issue 19475 (msg202242), "precision" may be a misleading name because 
python makes no guarantee about the precision of the computer clock.

Still, this feature is not appealing enough to try to squeeze into 3.7 release 
schedule.  I think this should go through a round of discussion either on 
datetime-sig or python-ideas.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32522>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32522] Add precision argument to datetime.now

2018-01-09 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

> replacing all elements of a datetime below a certain level is a very common 
> idiom

This can be accomplished rather efficiently by truncating a time tuple:

>>> t = datetime.now()
>>> datetime(*t.timetuple()[:6])
datetime.datetime(2018, 1, 9, 14, 47, 12)
>>> datetime(*t.timetuple()[:5])
datetime.datetime(2018, 1, 9, 14, 47)
>>> datetime(*t.timetuple()[:4])
datetime.datetime(2018, 1, 9, 14, 0)
>>> datetime(*t.timetuple()[:3])
datetime.datetime(2018, 1, 9, 0, 0)

if you do this often, you can wrap this in a function


_PARTS = {'seconds': 6, 'minutes': 5, ...}
def truncate_to(t, timespec):
return datetime(*t.timetuple()[:_PARTS[timespec])

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32522>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32522] Add precision argument to datetime.now

2018-01-09 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

> I think that a "truncate to rrule" function is *way* beyond the scope of the 
> standard library

I agree and I did not propose that.  What I said was that in the process of 
implementing truncate to rrule in dateutil you may encounter some common 
pattern that may benefit from a new stdlib datetime feature.

The operation that I often need is

def truncate_datetime(t:datetime, interval:timedelta, start=datetime.min) -> 
datetime
"""Return the largest datetime of the form start + interval * i not greater 
than t"""

but it is exactly the kind of one-liner that does not belong to stdlib.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32522>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32522] Add precision argument to datetime.now

2018-01-09 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

The problem that I have with the round/truncate proposal is that it is not 
general enough.  Days, hours, minutes etc. are just arbitrary intervals that 
became popular for obscure historical and astronomical reasons.  In practice, 
you are as likely to encounter 1 second timeseries as say 10 second timeseries. 
 Hourly timeseries are as likely to use the "top of the hour" (0 minutes) as 
they are to use the "bottom of the hour" (30 minutes).  In general, you want to 
have a kind of "snap to grid" functionality on the time axis where "the grid" 
is an arbitrary RRULE.

Looking at the dateutil, I don't see a truncate to rrule function.  Maybe a 
good starting point would be to implement that in dateutil and if some simpler 
pattern emerges that can be proposed for stdlib, we can discuss it then.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32522>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32522] Add precision argument to datetime.now

2018-01-09 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

In my experience, when dealing with temporal data truncation (rounding towards 
-infinity) is more useful than any other form of rounding. See also issue 19475.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32522>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32522] Add precision argument to datetime.now

2018-01-09 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

Maybe __round__ can be generalized to take a timedelta instead of ndigits?

For some related prior art, take a look at 
<http://code.kx.com/q/ref/arith-integer/#xbar>.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32522>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-20 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:


New changeset 09dc2f508c8513e0466a759cc27a09108c1e55c2 by Alexander Belopolsky 
(Paul Ganssle) in branch 'master':
bpo-15873: Implement [date][time].fromisoformat (#4699)
https://github.com/python/cpython/commit/09dc2f508c8513e0466a759cc27a09108c1e55c2


--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15873>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32267] strptime misparses offsets with microsecond format

2017-12-12 Thread Alexander Belopolsky

Change by Alexander Belopolsky <alexander.belopol...@gmail.com>:


--
nosy: +p-ganssle

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32267>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-04 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

+1 on what Paul said.

Mathieu, the goal for 3.7 will be to get Paul's PR merged.  It will be great if 
you could help in reviewing it.  We can return to the features in your PR 
during the 3.8 development cycle.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15873>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-04 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

The better is the enemy of the good here.  Given the history of this issue, I 
would rather accept a well documented restrictive parser than wait for a more 
general code to be written.  Note that we can always relax the parsing rules in 
the future.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15873>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32195] datetime.strftime with %Y no longer outputs leading zeros

2017-12-01 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

Isn't this a duplicate of issue 13305?

--
status: pending -> open

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32195>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31894] test_timestamp_naive failed on NetBSD

2017-10-29 Thread Alexander Belopolsky

Alexander Belopolsky <alexander.belopol...@gmail.com> added the comment:

> The documentation only says “datetime.timestamp” calls “mktime”

Indeed.  See 
<https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp>.

This is a documentation bug.  Since 3.6 the timestamp does not call
mktime.  In fact, mktime should not be called anywhere in the datetime
module. See 
<https://github.com/python/cpython/blob/a2314283ff87c65e1745a42c2f2b716b1a209128/Modules/_datetimemodule.c#L5315>.

For the explanation of why mktime is not a good API, see PEP 495.

On Sun, Oct 29, 2017 at 9:30 PM, Martin Panter <rep...@bugs.python.org> wrote:
>
> Martin Panter <vadmium...@gmail.com> added the comment:
>
> Are you sure it is a “system” bug? As far as I understand, at least Posix 
> does not require support for local time before 1970. See 
> <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16>.
>
> But why is localtime(14400) relevant? The documentation only says 
> “datetime.timestamp” calls “mktime”, which should be valid since the UTC-5 
> timezone offset will give a positive timestamp. Perhaps is this similar to 
> Issue 29097, probing a date before 1970?
>
> --
> nosy: +martin.panter
>
> ___
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue31894>
> ___

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31894>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   6   7   8   9   10   >