spectral added inline comments.

INLINE COMMENTS

> bser.c:106
> +  if (i == 8 && PySequence_Size(obj->values) < 7) {
> +    // Hack alert: Python 3 removed support for os.stat().st_mtime
> +    // being an integer.Instead, if you need an integer, you have to

My system pythons (2.7.13 and 3.5.3) have the following behaviors:

≻ python -c 'from __future__ import print_function; import os, sys, stat; 
print(sys.version); s=os.stat("."); print(s.st_mtime, s[stat.ST_MTIME], 
type(s.st_mtime), type(s[stat.ST_MTIME]), stat.ST_MTIME)'
2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516]
1522089418.2 1522089418 <type 'float'> <type 'int'> 8

≻ python3 -c 'from __future__ import print_function; import os, sys, stat; 
print(sys.version); s=os.stat("."); print(s.st_mtime, s[stat.ST_MTIME], 
type(s.st_mtime), type(s[stat.ST_MTIME]), stat.ST_MTIME)' 
3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170118]
1522089422.693618 1522089422 <class 'float'> <class 'int'> 8

Seems like we could just use int(os.stat().st_mtime) instead of 
os.stat()[stat.ST_MTIME]  (if we really need an int instead of a float), and 
avoid most of the issues with attempting to access a stat_result that isn't the 
official one (like the one we create in cext/osutil.c, or I know other 
extensions create...)

I have no idea if that would solve this actual problem though, bser might be a 
separate problem from what I'm thinking of.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2939

To: durin42, #hg-reviewers, indygreg
Cc: spectral, indygreg, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to