mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.8'
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -54,6 +54,10 @@ Features added
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #5418: Incorrect default path for sphinx-build -d/doctrees files
|
||||
* #5421: autodoc emits deprecation warning for :confval:`autodoc_default_flags`
|
||||
* #5422: lambda object causes PicklingError on storing environment
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ def build_main(argv=sys.argv[1:]): # type: ignore
|
||||
args.confdir = args.sourcedir
|
||||
|
||||
if not args.doctreedir:
|
||||
args.doctreedir = os.path.join(args.sourcedir, '.doctrees')
|
||||
args.doctreedir = os.path.join(args.outputdir, '.doctrees')
|
||||
|
||||
# handle remaining filename arguments
|
||||
filenames = args.filenames
|
||||
|
||||
@@ -38,7 +38,7 @@ if False:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_FILENAME = 'conf.py'
|
||||
UNSERIALIZEABLE_TYPES = class_types + (types.ModuleType, types.FunctionType)
|
||||
UNSERIALIZABLE_TYPES = class_types + (types.ModuleType, types.FunctionType)
|
||||
copyright_year_re = re.compile(r'^((\d{4}-)?)(\d{4})(?=[ ,])')
|
||||
|
||||
if PY3:
|
||||
@@ -49,6 +49,21 @@ ConfigValue = NamedTuple('ConfigValue', [('name', str),
|
||||
('rebuild', Union[bool, unicode])])
|
||||
|
||||
|
||||
def is_serializable(obj):
|
||||
# type: (Any) -> bool
|
||||
"""Check if object is serializable or not."""
|
||||
if isinstance(obj, UNSERIALIZABLE_TYPES):
|
||||
return False
|
||||
elif isinstance(obj, dict):
|
||||
for key, value in iteritems(obj):
|
||||
if not is_serializable(key) or not is_serializable(value):
|
||||
return False
|
||||
elif isinstance(obj, (list, tuple, set)):
|
||||
return all(is_serializable(i) for i in obj)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
class ENUM(object):
|
||||
"""represents the config value should be a one of candidates.
|
||||
|
||||
@@ -317,7 +332,7 @@ class Config(object):
|
||||
# remove potentially pickling-problematic values from config
|
||||
__dict__ = {}
|
||||
for key, value in iteritems(self.__dict__):
|
||||
if key.startswith('_') or isinstance(value, UNSERIALIZEABLE_TYPES):
|
||||
if key.startswith('_') or not is_serializable(value):
|
||||
pass
|
||||
else:
|
||||
__dict__[key] = value
|
||||
@@ -326,7 +341,7 @@ class Config(object):
|
||||
__dict__['values'] = {}
|
||||
for key, value in iteritems(self.values): # type: ignore
|
||||
real_value = getattr(self, key)
|
||||
if isinstance(real_value, UNSERIALIZEABLE_TYPES):
|
||||
if not is_serializable(real_value):
|
||||
# omit unserializable value
|
||||
real_value = None
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ from docutils.statemachine import ViewList
|
||||
from six import iteritems, itervalues, text_type, class_types, string_types
|
||||
|
||||
import sphinx
|
||||
from sphinx.deprecation import RemovedInSphinx30Warning
|
||||
from sphinx.ext.autodoc.importer import mock, import_object, get_object_members
|
||||
from sphinx.ext.autodoc.importer import _MockImporter # to keep compatibility # NOQA
|
||||
from sphinx.locale import _, __
|
||||
@@ -1442,9 +1443,13 @@ def merge_autodoc_default_flags(app, config):
|
||||
if not config.autodoc_default_flags:
|
||||
return
|
||||
|
||||
logger.warning(__('autodoc_default_flags is now deprecated. '
|
||||
'Please use autodoc_default_options instead.'),
|
||||
type='autodoc')
|
||||
# Note: this option will be removed in Sphinx-4.0. But I marked this as
|
||||
# RemovedInSphinx *30* Warning because we have to emit warnings for users
|
||||
# who will be still in use with Sphinx-3.x. So we should replace this by
|
||||
# logger.warning() on 3.0.0 release.
|
||||
warnings.warn('autodoc_default_flags is now deprecated. '
|
||||
'Please use autodoc_default_options instead.',
|
||||
RemovedInSphinx30Warning)
|
||||
|
||||
for option in config.autodoc_default_flags:
|
||||
if isinstance(option, string_types):
|
||||
|
||||
@@ -373,7 +373,7 @@ class Signature(object):
|
||||
# python 3.5.2 raises ValueError for partial objects.
|
||||
self.annotations = {}
|
||||
else:
|
||||
logger.warning('Invalid type annotation found on %r. Ingored: %r',
|
||||
logger.warning('Invalid type annotation found on %r. Ignored: %r',
|
||||
subject, exc)
|
||||
self.annotations = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user