[pypy-commit] pypy py3.6: CPython Issue #26129: grp.getgrgid() sends a DeprecationWarning when passing non-integers
amauryfa
pypy.commits at gmail.com
Thu Mar 1 06:41:55 EST 2018
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.6
Changeset: r93932:0ebac2fc9fb1
Date: 2018-02-26 01:13 +0100
http://bitbucket.org/pypy/pypy/changeset/0ebac2fc9fb1/
Log: CPython Issue #26129: grp.getgrgid() sends a DeprecationWarning when
passing non-integers
diff --git a/lib_pypy/grp.py b/lib_pypy/grp.py
--- a/lib_pypy/grp.py
+++ b/lib_pypy/grp.py
@@ -33,7 +33,13 @@
@builtinify
def getgrgid(gid):
- res = lib.getgrgid(gid)
+ try:
+ res = lib.getgrgid(gid)
+ except TypeError:
+ gid = int(gid)
+ res = lib.getgrgid(gid)
+ import warnings
+ warnings.warn("group id must be int", DeprecationWarning)
if not res:
# XXX maybe check error eventually
raise KeyError(gid)
More information about the pypy-commit
mailing list