Skip to content

Commit e4e251d

Browse files
author
Franziska Geiger
committed
Rework of none type fix in regex findings
1 parent ebde502 commit e4e251d

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ wrapper scripts and makes the implementation usable from shell as standard Pytho
2121
execute the following command in the project directory:
2222

2323
```
24-
mx graalpython -m venv <dir-to-venv>
24+
mx python -m venv <dir-to-venv>
2525
```
2626

2727
To activate the environment in your shell session call:

graalpython/com.oracle.graal.python.test/src/tests/test_re.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,4 +454,5 @@ def test_none_value():
454454

455455
n = next(stream)
456456
assert not n[0]
457+
assert str(n[0]) == 'None'
457458

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object/ObjectBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ String repr(VirtualFrame frame, Object self,
300300
@Cached("create(__MODULE__)") GetFixedAttributeNode readModuleNode,
301301
@Cached("create(__QUALNAME__)") GetFixedAttributeNode readQualNameNode) {
302302
if (self == PNone.NONE) {
303-
return "";
303+
return "None";
304304
}
305305
PythonAbstractClass type = getClass.execute(self);
306306
Object moduleName = readModuleNode.executeObject(frame, type);

graalpython/lib-graalpython/_sre.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,15 @@ def __sanitize_out_type(self, elem):
339339
returned list if always either 'str' or 'bytes'."""
340340
if self.__binary:
341341
return bytes(elem)
342+
elif elem is None:
343+
return None
342344
else:
343345
return str(elem)
344346

345347
def finditer(self, string, pos=0, endpos=-1):
346348
self.__check_input_type(string)
347-
if endpos > len(string):
349+
# print('String to find iter:' , string)
350+
if endpos > len(string) or len(string) == 0:
348351
endpos = len(string)
349352
elif endpos < 0:
350353
endpos = endpos % len(string) + 1

0 commit comments

Comments
 (0)