GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix metaclass keyword parameter in class definition, add getcwdb to p… · jython/jython3@d884642

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • CPythonLib.includes
  • lib-python/3.5
    • abc.py
    • posixpath.py
  • src/org/python
    • compiler
      • CodeCompiler.java
    • core
      • imp.java
    • modules
      • _sre.java
      • posix
        • PosixModule.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎CPythonLib.includes‎

Copy file name to clipboardExpand all lines: CPythonLib.includes
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ _LWPCookieJar.py
2020
_MozillaCookieJar.py
2121
_pyio.py
2222
_strptime.py
23+
_sitebuiltins.py
2324
_threading_local.py
2425
_weakrefset.py
2526
abc.py
Collapse file

‎lib-python/3.5/abc.py‎

Copy file name to clipboardExpand all lines: lib-python/3.5/abc.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ class ABCMeta(type):
130130
_abc_invalidation_counter = 0
131131

132132
def __new__(mcls, name, bases, namespace):
133-
cls = super().__new__(mcls, name, bases, namespace)
133+
cls = type.__new__(mcls, name, bases, namespace)
134134
# Compute set of abstract method names
135135
abstracts = {name
136-
for name, value in namespace.items()
136+
for name, value in dict(namespace).items()
137137
if getattr(value, "__isabstractmethod__", False)}
138138
for base in bases:
139139
for name in getattr(base, "__abstractmethods__", set()):
Collapse file

‎lib-python/3.5/posixpath.py‎

Copy file name to clipboardExpand all lines: lib-python/3.5/posixpath.py
+46-1Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"ismount", "expanduser","expandvars","normpath","abspath",
2323
"samefile","sameopenfile","samestat",
2424
"curdir","pardir","sep","pathsep","defpath","altsep","extsep",
25-
"devnull","realpath","supports_unicode_filenames","relpath"]
25+
"devnull","realpath","supports_unicode_filenames","relpath",
26+
"commonpath"]
2627

2728
# Strings representing various path-related bits and pieces.
2829
# These are primarily for export; internally, they are hardcoded.
@@ -75,6 +76,8 @@ def join(a, *p):
7576
sep = _get_sep(a)
7677
path = a
7778
try:
79+
if not p:
80+
path[:0] + sep #23780: Ensure compatible data type even if p is null.
7881
for b in p:
7982
if b.startswith(sep):
8083
path = b
@@ -455,3 +458,45 @@ def relpath(path, start=None):
455458
except (TypeError, AttributeError, BytesWarning, DeprecationWarning):
456459
genericpath._check_arg_types('relpath', path, start)
457460
raise
461+
462+
463+
# Return the longest common sub-path of the sequence of paths given as input.
464+
# The paths are not normalized before comparing them (this is the
465+
# responsibility of the caller). Any trailing separator is stripped from the
466+
# returned path.
467+
468+
def commonpath(paths):
469+
"""Given a sequence of path names, returns the longest common sub-path."""
470+
471+
if not paths:
472+
raise ValueError('commonpath() arg is an empty sequence')
473+
474+
if isinstance(paths[0], bytes):
475+
sep = b'/'
476+
curdir = b'.'
477+
else:
478+
sep = '/'
479+
curdir = '.'
480+
481+
try:
482+
split_paths = [path.split(sep) for path in paths]
483+
484+
try:
485+
isabs, = set(p[:1] == sep for p in paths)
486+
except ValueError:
487+
raise ValueError("Can't mix absolute and relative paths") from None
488+
489+
split_paths = [[c for c in s if c and c != curdir] for s in split_paths]
490+
s1 = min(split_paths)
491+
s2 = max(split_paths)
492+
common = s1
493+
for i, c in enumerate(s1):
494+
if c != s2[i]:
495+
common = s1[:i]
496+
break
497+
498+
prefix = sep if isabs else sep[:0]
499+
return prefix + sep.join(common)
500+
except (TypeError, AttributeError):
501+
genericpath._check_arg_types('commonpath', *paths)
502+
raise
Collapse file

‎src/org/python/compiler/CodeCompiler.java‎

Copy file name to clipboardExpand all lines: src/org/python/compiler/CodeCompiler.java
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2436,7 +2436,6 @@ public Object visitClassDef(ClassDef node) throws Exception {
24362436
code.aload(baseArray);
24372437
if (node.getInternalKeywords() != null && node.getInternalKeywords().size() > 0) {
24382438
// Assume only keywords parameter is the metaclass
2439-
assert node.getInternalKeywords().get(0).getInternalArg().equals("metaclass");
24402439
visit(node.getInternalKeywords().get(0).getInternalValue());
24412440
} else {
24422441
code.aconst_null();
Collapse file

‎src/org/python/core/imp.java‎

Copy file name to clipboardExpand all lines: src/org/python/core/imp.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ private static PyObject loadBuiltin(String name) {
548548
Py.writeComment(IMPORT_LOG, "'" + name + "' as sys in builtin modules");
549549
return Py.java2py(Py.getSystemState());
550550
}
551-
if (name == "__builtin__") {
551+
if (name == "__builtin__" || name == "builtins") {
552552
Py.writeComment(IMPORT_LOG, "'" + name + "' as __builtin__ in builtin modules");
553553
return new PyModule("__builtin__", Py.getSystemState().builtins);
554554
}
Collapse file

‎src/org/python/modules/_sre.java‎

Copy file name to clipboardExpand all lines: src/org/python/modules/_sre.java
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public class _sre {
2424

2525
// probably the right number for Jython since we are UTF-16.
2626
public static int MAXREPEAT = 65535;
27+
28+
public static int MAXGROUPS = 65535;
2729

2830
// workaround the fact that H, I types are unsigned, but we are not really using them as such
2931
// XXX: May not be the right size, but I suspect it is -- see sre_compile.py
Collapse file

‎src/org/python/modules/posix/PosixModule.java‎

Copy file name to clipboardExpand all lines: src/org/python/modules/posix/PosixModule.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,16 +488,16 @@ public static void ftruncate(PyObject fd, long length) {
488488

489489
public static PyString __doc__getcwd = new PyString(
490490
"getcwd() -> path\n\n" +
491-
"Return a string representing the current working directory.");
491+
"Return a unicode string representing the current working directory.");
492492
public static PyObject getcwd() {
493493
return Py.newStringOrUnicode(Py.getSystemState().getCurrentWorkingDir());
494494
}
495495

496-
public static PyString __doc__getcwdu = new PyString(
496+
public static PyString __doc__getcwdb = new PyString(
497497
"getcwd() -> path\n\n" +
498-
"Return a unicode string representing the current working directory.");
499-
public static PyObject getcwdu() {
500-
return Py.newUnicode(Py.getSystemState().getCurrentWorkingDir());
498+
"Return a bytes string representing the current working directory.");
499+
public static PyObject getcwdb() {
500+
return Py.newString(Py.getSystemState().getCurrentWorkingDir());
501501
}
502502

503503
public static PyString __doc__getegid = new PyString(

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.