Skip to content

Commit 2404d95

Browse files
committed
Add test for no nulls in OSError args
1 parent d759410 commit 2404d95

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3737
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3838
# SOFTWARE.
39+
import errno
3940

4041
try:
4142
__graalpython__.posix_module_backend()
@@ -883,8 +884,13 @@ def test_sysconf(self):
883884
os.sysconf(object())
884885
with self.assertRaisesRegex(ValueError, 'unrecognized'):
885886
os.sysconf("nonexistent")
886-
with self.assertRaisesRegex(OSError, "Invalid argument"):
887+
try:
887888
os.sysconf(123456)
889+
except OSError as e:
890+
# We used to have a bug that the args would contain Java null for the filename in the args
891+
assert e.args == (errno.EINVAL, "Invalid argument")
892+
else:
893+
assert False
888894

889895

890896
if __name__ == '__main__':

0 commit comments

Comments
 (0)