Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase size of index, line, and column fields #310

Merged
merged 8 commits into from
Dec 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@ image:
environment:
libyaml_repo_url: https://github.com/yaml/libyaml.git
libyaml_refspec: 0.2.2
PYYAML_TEST_GROUP: all

# matrix:
# - PYTHON_VER: Python27
# - PYTHON_VER: Python27-x64
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ language: python

cache: pip

env:
global:
- PYYAML_TEST_GROUP=all

matrix:
include:
- python: 2.7
8 changes: 4 additions & 4 deletions ext/_yaml.pyx
Original file line number Diff line number Diff line change
@@ -63,13 +63,13 @@ MappingNode = yaml.nodes.MappingNode

cdef class Mark:
cdef readonly object name
cdef readonly int index
cdef readonly int line
cdef readonly int column
cdef readonly size_t index
cdef readonly size_t line
cdef readonly size_t column
cdef readonly buffer
cdef readonly pointer

def __init__(self, object name, int index, int line, int column,
def __init__(self, object name, size_t index, size_t line, size_t column,
object buffer, object pointer):
self.name = name
self.index = index
18 changes: 17 additions & 1 deletion tests/lib/test_yaml_ext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import _yaml, yaml
import types, pprint
import types, pprint, tempfile, sys, os

yaml.PyBaseLoader = yaml.BaseLoader
yaml.PySafeLoader = yaml.SafeLoader
@@ -233,6 +233,22 @@ def test_c_emitter(data_filename, canonical_filename, verbose=False):
test_c_emitter.unittest = ['.data', '.canonical']
test_c_emitter.skip = ['.skip-ext']

def test_large_file(verbose=False):
SIZE_LINE = 24
SIZE_ITERATION = 0
SIZE_FILE = 31
if sys.maxsize <= 2**32:
return
if os.environ.get('PYYAML_TEST_GROUP', '') != 'all':
return
with tempfile.TemporaryFile() as temp_file:
for i in range(2**(SIZE_FILE-SIZE_ITERATION-SIZE_LINE) + 1):
temp_file.write(('-' + (' ' * (2**SIZE_LINE-4))+ '{}\n')*(2**SIZE_ITERATION))
temp_file.seek(0)
yaml.load(temp_file, Loader=yaml.CLoader)

test_large_file.unittest = None

def wrap_ext_function(function):
def wrapper(*args, **kwds):
_set_up()
18 changes: 17 additions & 1 deletion tests/lib3/test_yaml_ext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import _yaml, yaml
import types, pprint
import types, pprint, tempfile, sys, os

yaml.PyBaseLoader = yaml.BaseLoader
yaml.PySafeLoader = yaml.SafeLoader
@@ -233,6 +233,22 @@ def test_c_emitter(data_filename, canonical_filename, verbose=False):
test_c_emitter.unittest = ['.data', '.canonical']
test_c_emitter.skip = ['.skip-ext']

def test_large_file(verbose=False):
SIZE_LINE = 24
SIZE_ITERATION = 0
SIZE_FILE = 31
if sys.maxsize <= 2**32:
return
if os.environ.get('PYYAML_TEST_GROUP', '') != 'all':
return
with tempfile.TemporaryFile() as temp_file:
dwightguth marked this conversation as resolved.
Show resolved Hide resolved
for i in range(2**(SIZE_FILE-SIZE_ITERATION-SIZE_LINE) + 1):
temp_file.write(bytes(('-' + (' ' * (2**SIZE_LINE-4))+ '{}\n')*(2**SIZE_ITERATION), 'utf-8'))
temp_file.seek(0)
yaml.load(temp_file, Loader=yaml.CLoader)

test_large_file.unittest = None

def wrap_ext_function(function):
def wrapper(*args, **kwds):
_set_up()