[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-04-26 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 Somehow patch #2 doesn't show up in Rietveld. :-(

It's because it's a git-style diff, so it includes no base revision,
and it didn't apply cleanly to the default head (which is tried as
a fall-back in case of a missing base revision).

--
title: add st_*time_ns fields to os.stat(), add ns keyword to os.*utime*(), 
os.*utimens*() expects a number of nanoseconds - add st_*time_ns fileds to 
os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of 
nanoseconds

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-04-19 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset f554043badec by Larry Hastings in branch 'default':
Issue #14127: Add st_{cma}time_ns fields to os.stat() result object.
http://hg.python.org/cpython/rev/f554043badec

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-04-03 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Sorry to let this slide but I just got back from vacation.  Unless anybody has 
any more feedback I'm checking this in tomorrow (Wednesday April 4).  Phew!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-19 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Revision 7 of my patch.  Incorporates all suggestions from Georg.  Added as an 
integer in the docs to make Antoine happy.

If I fail to create the billion int in INITFUNC, I return NULL and leak 
references.  I figure this is fine, as a) the other such tests in this function 
also leak, and b) if you can't initialize the os module, you're not going to 
have a very productive session.

Dare I dream that it's ready for checkin?

--
Added file: http://bugs.python.org/file24951/larry.st_mtime_ns.patch.7.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-19 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

 Revision 7 of my patch.

-assert(sizeof(time_t) = sizeof(long));

You should keep this assertion in _PyLong_FromTime_t().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-19 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Incorporated Victor's reinstated assert suggestion.  Fingers crossed.

--
Added file: http://bugs.python.org/file24952/larry.st_mtime_ns.patch.8.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-19 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

The patch looks good to me. I was going to commit it but then I realized that 
Larry is a core developer. Last nits: you should add a newline after } in } 
else {, and it would be better to move billion variable into fill_time(). 
Something like:

static void
fill_time(PyObject *v, int index, time_t sec, unsigned long nsec)
{
...
static PyObject *billion = NULL;

if (billion == NULL) {
billion = PyLong_FromLong(10);
if (!billion)
return;
}
...
}

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-19 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

 The patch looks good to me. I was going to commit it
 but then I realized that Larry is a core developer.

Indeed; please permit me the pleasure of checking it in myself.  That is, 
assuming I actually get the go-ahead someday.  (Probably in the far-flung 
future.  I'm imagining my house CPU telling me the good news via my cranial 
implant.  Perhaps while I'm landing my jet car!)


 Last nits: you should add a newline after } in } else {,

1/3 of the else { statements in the Python tree are } else {.  And that's 
not a new line with me; I merely renamed the variable.

But I just checked, and PEP 7 says so, and I figure it's harmless enough, so I 
have made that change.


 and it would be better to move billion variable into fill_time().

That's how it was until patch 5 or 6 or so.  Greg P. Smith suggested moving 
into INITFUNC and I agreed.  I think it should stay where it is.


Attached is patch #9, adding a newline between } and else as Victor 
suggests.

--
Added file: http://bugs.python.org/file24954/larry.st_mtime_ns.patch.9.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-17 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Incorporated Greg's (hopefully) parting shot.  Also put the as an integer 
back for the docs.  Finally, munged the note about float seconds vs integer 
nanoseconds a bit; I think it's an improvement.

Can I get the go ahead now, pretty please?

--
assignee:  - larry
stage:  - patch review
Added file: http://bugs.python.org/file24908/larry.st_mtime_ns.patch.6.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-16 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Updated patch incorporating only one of Antoine's latest suggestions.  Please 
see my reply on Reitveld for r3 as to why I skipped two of your three 
suggestions.

--
Added file: http://bugs.python.org/file24884/larry.st_mtime_ns.patch.4.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

My revised patch, incorporating changes suggested by Antoine and Guido.

--
Added file: http://bugs.python.org/file24859/larry.st_mtime_ns.patch.2.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Guido van Rossum

Guido van Rossum gu...@python.org added the comment:

Somehow patch #2 doesn't show up in Rietveld. :-(

Anyway, I'll leave completion of the review to Antoine, who's more competent in 
this area. :-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Attached is a second patch that adds keyword-only argument support to 
PyArg_ParseTupleAndKeywords.  This was developed in isolation.

The magic character is '$'; I would have used '*', but we already use '*' in 
the format string as a modifier to 'U' and 's' etc.  If someone has a better 
idea for the format I'd be interested.  Martin suggested using '|' a second 
time but I am unsure.

(Re: no reitveld link: my repo must have drifted too far and the patch didn't 
align cleanly.  I've freshened and am rerunning the regression test; once that 
runs clean I'll upload a fresh patch.)

--
Added file: http://bugs.python.org/file24874/larry.parsekwonly.diff.1.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Attached is a second patch that adds keyword-only argument support to
 PyArg_ParseTupleAndKeywords.  This was developed in isolation.

Please post that on a dedicated issue :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Do you insist?  It's a small patch, and I need it as a precondition to posting 
the... *third* patch in this series, which adds the ns= parameter to utime and 
its brothers.  (Most of the patch is test and doc; it really only adds about 
twenty lines of C.)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

A fresh patch for adding st_mtime_ns etc to os.stat output.  This is the same 
as last night's patch but with fresh line numbers.  (Generated against 
44eba26951f6.)

--
Added file: http://bugs.python.org/file24875/larry.st_mtime_ns.patch.3.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Do you insist?  It's a small patch, and I need it as a precondition to
 posting the...

Yes, I do. It might a small patch, but it changes a core API and should
be discussed on its own.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Posted a last review on Rietveld.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Gregory P. Smith

Changes by Gregory P. Smith g...@krypto.org:


--
nosy: +gregory.p.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-15 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

I've created a separate issue for adding keyword-only parameter support to 
PyArg_ParseTupleAndKeywords, #14328.  I've also posted a new patch to that 
issue incorporating Greg's suggestions.  Please file all further comments 
regarding this topic on that issue.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-14 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

Guido suggested I break the work up into small patches.  So here's the first 
patch: adds st_?time_ns fields to os.stat() result.  Includes doc changes and a 
reasonable smoke-test in the regrtest suite; suite passes all expected tests.  
FYI I wasn't sure what to call the currently-slightly-uncomfortably-named new 
function _PyTime_LongFromTime_t().

--
Added file: http://bugs.python.org/file24838/larry.st_mtime_ns.patch.1.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-14 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Posted a review on Rietveld.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-14 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

 FYI I wasn't sure what to call the currently-slightly-uncomfortably-named new 
 function _PyTime_LongFromTime_t().

There is already a private _PyLong_FromTime_t() function in
_testcapi.c: just move the function to pytime.c (but keep the _Py
prefix).

--
title: add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), 
os.*utimens*() expects a number of nanoseconds - add st_*time_ns fileds to 
os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of 
nanoseconds

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-14 Thread Guido van Rossum

Guido van Rossum gu...@python.org added the comment:

I added a review as well. Not sure if that sends email by itself.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-14 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 I added a review as well. Not sure if that sends email by itself.

It's supposed to send e-mail, but sometimes not all recipients are spelt
right...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-14 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

I was notified by email of both Antoine's and Guido's reviews.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-13 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
title: os.stat and os.utime: allow preserving exact metadata - add st_*time_ns 
fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a 
number of nanoseconds

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-13 Thread STINNER Victor

STINNER Victor victor.stin...@gmail.com added the comment:

The following changes has to be done to fix this issue:

 - add st_atime_ns, st_mtime_ns and st_ctime_ns fileds to os.stat() result: 
number of nanoseconds since Epoch (1970.1.1), an integer
 - change os.*utime*() functions (see below)
 - shutil.copystat() should use os.utime(ns=...) and os.ltime(ns=...)

List of the os.*utime*() functions:

 - os.futimes(): use futimens() or futimes()
 - os.futimens(): use futimens(); UTIME_NOW and UTIME_OMIT flags
 - os.futimesat(): use utimensat() or futimesat()
 - os.lutimes(): use futimesat(AT_SYMLINK_NOFOLLOW) or lutimes()
 - os.utime(): use SetFileTime() (Windows), utimensat(), utimes() or utime()
 - os.utimensat(): use utimensat(); UTIME_NOW and UTIME_OMIT flags

Changes on the os.*utime*() functions:

 - add ns keyword to:

   * os.futimes()
   * os.futimesat()
   * os.lutimes()
   * os.utime()

 - except a number of nanoseconds instead of a number of seconds:

   * os.futimens()
   * os.utimensat()

The ns keyword is an exclusive parameter with existing times parameter. 
Examples:

   * seconds: os.utime(name, (1, 2))
   * seconds: os.utime(name, times=(1, 2))
   * nanoseconds: os.utime(name, ns=(1, 2))
   * INVALID! os.utime(name, (1, 2), ns=(1, 2))
   * INVALID! os.utime(name, times=(1, 2), ns=(1, 2))

I don't want to remove os.futimens() and os.utimensat() because they add a 
feature: UTIME_NOW and UTIME_OMIT flags.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-13 Thread Guido van Rossum

Guido van Rossum gu...@python.org added the comment:

Larry, are you sprinting on this? I'd love to help.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-13 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 I don't want to remove os.futimens() and os.utimensat() because they add a 
 feature: UTIME_NOW and UTIME_OMIT flags.

I'm not sure how this could work: UTIME_NOW and UTIME_OMIT have 
typically values such as ((1l  30) - 2l) which could be mistaken
as a time stamp if there is a flat nanosecond value.

There would be ways to solve this, of course: not passing the
value should be considered as UTIME_OMIT, and passing -1 may
be treated as UTIME_NOW.

--
title: add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), 
os.*utimens*() expects a number of nanoseconds - add st_*time_ns fileds to 
os.stat(),  add ns keyword to os.*utime*(), os.*utimens*() expects a number 
of nanoseconds

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14127] add st_*time_ns fileds to os.stat(), add ns keyword to os.*utime*(), os.*utimens*() expects a number of nanoseconds

2012-03-13 Thread Larry Hastings

Larry Hastings la...@hastings.org added the comment:

 Larry, are you sprinting on this? I'd love to help.

I am.  Come on by--mi CPU es tu CPU!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14127
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com