Code

Opened 23 months ago

Closed 22 months ago

Last modified 22 months ago

#18457 closed Bug (fixed)

Failed test: pyyaml serializer,

Reported by: jpaugh64 Owned by: claudep
Component: Core (Serialization) Version: master
Severity: Normal Keywords: unicode
Cc: jpaugh64 Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The patch introduced by commit 4a10308 causes the pyyaml deserializer to fail the test suite. The error is caused by trying to wrap a unicode string in an io.BytesIO. The relevant bits are in tests/regressiontests/serializers_regress/tests.py @line 408 and in django/core/serializers/pyyaml.py @line 51.

Attachments (1)

18457.diff (881 bytes) - added by jpaugh64 23 months ago.

Download all attachments as: .zip

Change History (5)

Changed 23 months ago by jpaugh64

comment:1 Changed 22 months ago by jpaugh64

  • Cc jpaugh64 added
  • Has patch set
  • Keywords unicode added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I just added a patch that fixes the bug. The problem was caused because pyyaml.Deserializer assumed it was dealing with a bytestring, but tested for basestring instead--causing it to try wrapping unicode objects in an io.BytesIO instance. (The bug wasn't uncovered until commit 4a10308 caused all strings in the test case to default to unicode) This patch tests for str and and unicode objects, and handles each appropriately.

comment:2 Changed 22 months ago by claudep

  • Owner changed from nobody to claudep
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 22 months ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In [1a10a06b9f510f796beb2ffef39c7885cba2ad67]:

Fixed #18457 -- Fixed encoding error in yaml deserializer

Thanks jpaugh64 for the report.

comment:4 Changed 22 months ago by claudep

Thanks for the report. I eventually choose to handle it the same way as in json.py.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.