summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 5.4 release5.4release/5.4Ingy döt Net2021-01-196-21/+39
|
* Fix compatibility with JythonAnish Athalye2021-01-131-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | This patch was taken from https://github.com/yaml/pyyaml/issues/369#issuecomment-571596545, authored by Pekka Klärck <peke@iki.fi>. In short, Jython doesn't support lone surrogates, so importing yaml (and in particular, loading `reader.py`) caused a UnicodeDecodeError. This patch works around this through a clever use of `eval` to defer evaluation of the string containing the lone surrogates, only doing it on non-Jython platforms. This is only done in `lib/yaml/reader.py` and not `lib3/yaml/reader.py` because Jython does not support Python 3. With this patch, Jython's behavior with respect to Unicode code points over 0xFFFF becomes as it was before 0716ae21a1e7ab6b4ef73428c0c8fff49685d057. It still does not pass all the unit tests on Jython (passes 1275, fails 3, errors on 1); all the failing tests are related to unicode. Still, this is better than simply crashing upon `import yaml`. With this patch, all tests continue to pass on Python 2 / Python 3.
* Run CI on PR base branch changesMatt Davis2021-01-131-0/+1
|
* constructor.timezone: __copy_ & __deepcopy__Ovv2021-01-132-0/+18
| | | | close #387
* Avoid repeatedly appending to yaml_implicit_resolversPhil Sphicas2021-01-132-4/+4
| | | | | | | | | | | | | | | | | | Repeated calls to `resolve` can experience performance degredation, if `add_implicit_resolver` has been called with `first=None` (to add an implicit resolver with an unspecified first character). For example, every time `foo` is encountered, the "wildcard implicit resolvers" (with `first=None`) will be appended to the list of implicit resolvers for strings starting with `f`, which will normally be the resolver for booleans. The list `yaml_implicit_resolvers['f']` will keep getting longer. The same behavior applies for any first-letter matches with existing implicit resolvers. This change avoids unintentionally mutating the lists in the class-level dict `yaml_implicit_resolvers` by looping through a temporary copy. Fixes: #439
* Fix for CVE-2020-14343Ingy döt Net2021-01-134-26/+26
| | | | | Per suggestion https://github.com/yaml/pyyaml/issues/420#issuecomment-663888344 move a few constructors from full_load to unsafe_load.
* Add 3.9 to appveyor file for completeness sakeIngy döt Net2021-01-131-0/+2
| | | | | Are we done with appveyor now? Can we just remove this file?
* Add a newline character to end of pyproject.tomlIngy döt Net2021-01-131-1/+1
| | | | | | | Is this TOML file actually needed? I'd prefer to remove it since it does so little, and stands out so prominiently.
* Start sentences and phrases for capital lettersIngy döt Net2021-01-131-35/+35
| | | | End sentences with periods.
* Shell code improvementsIngy döt Net2021-01-131-6/+4
|
* Remove unneeded quotesIngy döt Net2021-01-131-1/+1
|
* Use long forms for docker run optionsIngy döt Net2021-01-131-9/+9
|
* Better (non)use of literal form scalarsIngy döt Net2021-01-131-11/+5
|
* Replace ${{ x }} with ${{x}}Ingy döt Net2021-01-131-15/+15
| | | | | Spaces in the syntax make it harder to reason if there will be spaces in the rendering or not.
* Reduce long lines and adjust blank lines for clarityIngy döt Net2021-01-131-12/+34
|
* Don't overindent sequences in mapsIngy döt Net2021-01-131-161/+160
|
* Rename ci.yml to YAML preferred ci.yamlIngy döt Net2021-01-131-0/+0
|
* Add py29 to tox.ini envlistIngy döt Net2021-01-131-1/+1
|
* Build modernization (GHA, wheels, setuptools) (#407)Brad Solomon2021-01-1324-121/+522
| | | | | | | | | | | | | | | * Move most CI to GitHub Actions * Build sdist * Build manylinux1 wheels with libyaml ext (also tested with 2010 and 2014) * Build MacOS x86_64 wheels with libyaml ext * Windows wheel builds remain on AppVeyor until we drop 2.7 support in 6.0 * Smoke tests of all post-build artifacts * Add PEP517/518 build declaration (pyproject.toml with setuptools backend) * Fully move build to setuptools * Drop Python 3.5 support * Declare Python 3.9 support * Update PyPI metadata now that setuptools lets it flow through Co-authored-by: Matt Davis <mrd@redhat.com>
* Update list of maintainersTina Müller2020-04-011-1/+0
| | | | Remove myself
* Add ARM64 jobs in Travis-CI (#366)ossdev072020-03-191-0/+9
|
* Update announcement.msg5.3.1release/5.3.1Tina Müller2020-03-183-23/+16
|
* Move test files back into tests/data/Ingy döt Net2020-03-183-0/+0
|
* Update version to 5.3.1Tina Müller2020-03-173-3/+3
|
* Prevents arbitrary code execution during python/object/new constructor (#386)Riccardo Schirone2020-03-176-4/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Prevents arbitrary code execution during python/object/new constructor In FullLoader python/object/new constructor, implemented by construct_python_object_apply, has support for setting the state of a deserialized instance through the set_python_instance_state method. After setting the state, some operations are performed on the instance to complete its initialization, however it is possible for an attacker to set the instance' state in such a way that arbitrary code is executed by the FullLoader. This patch tries to block such attacks in FullLoader by preventing set_python_instance_state from setting arbitrary properties. It implements a blacklist that includes `extend` method (called by construct_python_object_apply) and all special methods (e.g. __set__, __setitem__, etc.). Users who need special attributes being set in the state of a deserialized object can still do it through the UnsafeLoader, which however should not be used on untrusted input. Additionally, they can subclass FullLoader and redefine `get_state_keys_blacklist()` to extend/replace the list of blacklisted keys, passing the subclassed loader to yaml.load. * Make sure python/object/new constructor does not set some properties * Add test to show how to subclass FullLoader with new blacklist
* Update announcement.msg5.3release/5.3Tina Müller2020-01-061-15/+21
|
* Changes for 5.3Tina Müller2020-01-064-4/+4
|
* Changes for 5.3b15.3b1Tina Müller2019-12-214-3/+21
|
* Add tests for timezone (#363)Tina Müller (tinita)2019-12-205-13/+41
| | | | After #163, this adds some test data to check if the datetime objects return the correct timezone
* Create timezone-aware datetimes when parsed as such (#163)Mattijs Ugen2019-12-202-11/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | * On load, now use aware datetimes if possible On loading data, if timestamps have an ISO "+HH:MM" UTC offset then the resultant datetime is converted to UTC. This change adds that timezone information to the datetime objects. Importantly, this addresses a Django warning (and potential error) that appears when using both YAML fixtures in a timezone-aware project. It was raised as a Django issue (https://code.djangoproject.com/ticket/18867), but subsequently closed because the Django devs felt that this is a PyYAML problem. * Create timezone-aware datetime in timezone from data * Create timezone-aware datetime in timezone from data for python2 * Define better timezone implementation for python2 * Handle timezone "Z" for python 3 * Handle timezone "Z" for python 2 * Fix code structure for Python 3 Call datetime.datetime constructor once at return. * Fix code structure for Python 2 Call datetime.datetime constructor once at return.
* tox.ini: passenv = PYYAML_TEST_GROUPTina Müller2019-12-201-0/+1
|
* remove some unused imports (#260)Frédéric Chapoton2019-12-203-3/+3
| | | | | | | | | | | | | | * remove some unused imports as suggested by lgtm https://lgtm.com/projects/g/yaml/pyyaml/ * add back import * from nodes * remove also sys import * remove mkpath import
* increase size of index, line, and column fields (#310)Dwight Guth2019-12-205-6/+44
| | | | | | | | | | | | | | | | * increase size of index, line, and column fields * use size_t instead of unsigned long long * better test infrastructure for test for large file * only run large file test when env var is set * fix review comments regarding env vars * fix missing import on python 3 * force all tests in CI
* Fix for Python 3.10 (#329)Hugo van Kemenade2019-12-204-4/+4
|
* Document that PyYAML is implemented with Cython (#244)Jon Dufresne2019-12-201-0/+1
|
* Use full_load in yaml-highlight example (#359)Tina Müller (tinita)2019-12-201-1/+1
|
* Enable certain unicode tests when maxunicode not > 0xffffTina Müller2019-12-205-0/+0
| | | | | | They were disabled in d6cbff662084dd94bde5421ece495482d1b14454 After #351 the tests are working again
* Fix reader for Unicode code points over 0xFFFF (#351)Anish Athalye2019-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the handling of inputs with Unicode code points over 0xFFFF when running on a Python 2 that does not have UCS-4 support (which certain distributions still ship, e.g. macOS). When Python is compiled without UCS-4 support, it uses UCS-2. In this situation, non-BMP Unicode characters, which have code points over 0xFFFF, are represented as surrogate pairs. For example, if we take u'\U0001f3d4', it will be represented as the surrogate pair u'\ud83c\udfd4'. This can be seen by running, for example: [i for i in u'\U0001f3d4'] In PyYAML, the reader uses a function `check_printable` to validate inputs, making sure that they only contain printable characters. Prior to this patch, on UCS-2 builds, it incorrectly identified surrogate pairs as non-printable. It would be fairly natural to write a regular expression that captures strings that contain only *printable* characters, as opposed to *non-printable* characters (as identified by the old code, so not excluding surrogate pairs): PRINTABLE = re.compile(u'^[\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]*$') Adding support for surrogate pairs to this would be straightforward, adding the option of having a surrogate high followed by a surrogate low (`[\uD800-\uDBFF][\uDC00-\uDFFF]`): PRINTABLE = re.compile(u'^(?:[\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]|[\uD800-\uDBFF][\uDC00-\uDFFF])*$') Then, this regex could be used as follows: def check_printable(self, data): if not self.PRINTABLE.match(data): raise ReaderError(...) However, matching printable strings, rather than searching for non-printable characters as the code currently does, would have the disadvantage of not identifying the culprit character (we wouldn't get the position and the actual non-printable character from a lack of a regex match). Instead, we can modify the NON_PRINTABLE regex to allow legal surrogate pairs. We do this by removing surrogate pairs from the existing character set and adding the following options for illegal uses of surrogate code points: - Surrogate low that doesn't follow a surrogate high (either a surrogate low at the start of a string, or a surrogate low that follows a character that's not a surrogate high): (?:^|[^\uD800-\uDBFF])[\uDC00-\uDFFF] - Surrogate high that isn't followed by a surrogate low (either a surrogate high at the end of a string, or a surrogate high that is followed by a character that's not a surrogate low): [\uD800-\uDBFF](?:[^\uDC00-\uDFFF]|$) The behavior of this modified regex should match the one that is used when Python is built with UCS-4 support.
* Add use of safe_load() function in README (#285)sblondon2019-12-071-0/+4
| | | | It helps people to use `safe_load` if they discover the library. It's more secure if `safe_load()` is used by default, and `load()` is used if it's necessary (and the developer knows what is does).
* Allow add_multi_constructor with None (#358)Tina Müller (tinita)2019-12-078-2/+137
| | | | | | | Loader.add_multi_constructor(None, myconstructor) Also add test for add_multi_constructor('!', ...) etc. See issue #317
* Fix handling of __slots__ (#161)Filip Salomonsson2019-12-076-4/+30
|
* Fix up small typoTim Gates2019-12-042-8/+8
| | | | Replace `intendation` with `indentation`.
* Use `is` instead of equality for comparing with NoneSergey Fursov2019-12-042-4/+4
|
* fix typos and stylistic nitDavid Kao2019-12-034-6/+6
|
* fixup! setup.py: python_requires='!=3.4.*',Christian Clauss2019-12-031-1/+1
|
* setup.py: Remove support for EOL Python 3.4Christian Clauss2019-12-031-1/+0
|
* tox.ini: Add py38 and remove py34Christian Clauss2019-12-031-1/+1
|
* Travis CI: Test on Python 3.8 production releaseChristian Clauss2019-12-031-4/+2
| | | Also drop the EOL Python 3.4 @hugovk Your review please.
* Fix appveyor.yml to use libyaml tag not branchTina Müller2019-12-031-1/+1
|
* Version 5.25.2release/5.2Tina Müller2019-12-025-12/+21
|