Update to 3.1.

This commit is contained in:
Thomas Moschny 2019-03-26 07:30:19 +01:00
parent 20732786a5
commit bd396c0f27
3 changed files with 5 additions and 53 deletions

View File

@ -1,49 +0,0 @@
From 0b8d39920a0415f4b5149a4ee6d9b05455683cf7 Mon Sep 17 00:00:00 2001
From: Waylan Limberg <waylan.limberg@icloud.com>
Date: Thu, 14 Mar 2019 09:17:31 -0400
Subject: [PATCH] Update CLI to support PyYAML 5.1
This should avoid any warnings. We use `unsafe_load` because users may
need to pass in actual Python objects. As this is only available from
the CLI, the user has much worse problems if an attacker can use this
as an attach vector.
---
markdown/__main__.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/markdown/__main__.py b/markdown/__main__.py
index 38d08fe..43e486c 100644
--- a/markdown/__main__.py
+++ b/markdown/__main__.py
@@ -26,9 +26,17 @@ import codecs
import warnings
import markdown
try:
- import yaml
+ # We use `unsafe_load` because users may need to pass in actual Python
+ # objects. As this is only available from the CLI, the user has much
+ # worse problems if an attacker can use this as an attach vector.
+ from yaml import unsafe_load as yaml_load
except ImportError: # pragma: no cover
- import json as yaml
+ try:
+ # Fall back to PyYAML <5.1
+ from yaml import load as yaml_load
+ except ImportError:
+ # Fall back to JSON
+ from json import load as yaml_load
import logging
from logging import DEBUG, WARNING, CRITICAL
@@ -97,7 +105,7 @@ def parse_options(args=None, values=None):
options.configfile, mode="r", encoding=options.encoding
) as fp:
try:
- extension_configs = yaml.load(fp)
+ extension_configs = yaml_load(fp)
except Exception as e:
message = "Failed parsing extension config file: %s" % \
options.configfile
--
2.20.1

View File

@ -2,14 +2,12 @@
%global pkgname markdown
Name: python-%{pkgname}
Version: 3.0.1
Version: 3.1
Release: 1%{?dist}
Summary: Markdown implementation in Python
License: BSD
URL: https://python-markdown.github.io/
Source0: https://files.pythonhosted.org/packages/source/M/%{srcname}/%{srcname}-%{version}.tar.gz
# Cherry-picked upstream commit 0861bb0d
Patch0: Markdown-3.0.1-pyaml.patch
BuildArch: noarch
%description
@ -101,6 +99,9 @@ ln -s markdown_py-%{python3_version} %{buildroot}%{_bindir}/markdown_py
%changelog
* Tue Mar 26 2019 Thomas Moschny <thomas.moschny@gmx.de> - 3.1-1
- Update to 3.1.
* Mon Mar 25 2019 Thomas Moschny <thomas.moschny@gmx.de> - 3.0.1-1
- Update to 3.0.1.
- Simplify spec file.

View File

@ -1 +1 @@
SHA512 (Markdown-3.0.1.tar.gz) = c648c1b8ecb3c907ff2bd636ec6c08b4b629967fb916913f77db641f6d61b83d16929af2f15f5695c8cdb9614031606110e02a7e0bbb3aab0be38a8e285f12f1
SHA512 (Markdown-3.1.tar.gz) = 360cad47524e8d7674ab36ebf5694134ef2b3c3e064c1d65ecad02bc2f17daf403e97c8124e83f370fbc8b1d223c4c647fc34e75f7a4ec7f91173c84e41e09eb